menu

Blogs

Lots of our people have lots of opinions. Here are just a few of them

ThoughtWorks embraces the individuality of the people in the organization and hence the opinions expressed in the blogs may contradict each other and also may not represent the opinions of ThoughtWorks.

Ruby Hash

One of the popular feature’s of Ruby’s Hash object is that you can specify a default value for entries in the hash. For example, a common use case is to count the frequency of objects in an array.

hash = Hash.new
%w( orange red blue orange ).each do |colour|
  hash[colour] ||= 0
  hash[colour] += 1
end

# hash => {"orange"=>2, "red"=>1, "blue"=>1} 

Using the Hash initializer we can specify the default value for the hash as 0, which simplifies our code:

hash = Hash.new(0)
%w( orange red blue orange ).each { |colour| hash[colour] += 1 }

# hash => {"orange"=>2,

Blog post by Jaco Pretorius
28 July 2014

Original Link

Final part of Collection Pipelines

In this final installment I touch on laziness, parallelism, and immutability then conclude by outlining when we should use collection pipelines.

Blog post by Martin Fowler
28 July 2014

Original Link

photostream 70

Cape Arago, OR

Blog post by Martin Fowler
26 July 2014

Original Link

Difference between sorted, sortWith and sortBy in Scala

Scala collections provide you three options for sorting: sorted( ), sortWith( ) and sortBy( ). Here is a simplified explanation:

sorted
Will sort the list using the natural ordering (based on the implicit Ordering passed)

sortBy (an attribute)
Sort by a given attribute using the attribute's type.
e.g. given a list of Person objects, if you want to sort them in ascending order of their age (which is an Int), you could simply say: personList.sortBy(_.age)

sortWith (a function)
Takes a comparator function. Useful when you want to specify a custom sorting logic. 
e.g. if you want to

Blog post by Gurpreet Luthra
26 July 2014

Original Link

Creating Irreversible Migrations in Rails

This is not something I do very often (or that I recommend at all), but when you need to mark a migration as irreversible, this is how you would do it.

class Example 

Again, use with care. Happy coding.

Blog post by Jaco Pretorius
25 July 2014

Original Link

Hacking ThoughtWorks recruitment (Part 4 – Technical interview)

This is the fourth article I’ve written on the ThoughtWorks recruitment process (for developers) and today I’m discussing the last developer-specific activity – the technical interview. The technical interview normally follows a successful pairing interview and the objective is to have a conversation with the candidate about their views on technology beyond coding.  For senior […]

Blog post by Andy Marks
24 July 2014

Original Link

Part 4 of Collection Pipelines: alternatives

In this installment I look at alternatives to using a collection pipeline: loops and comprehensions.

Blog post by Martin Fowler
24 July 2014

Original Link

Hubris versus Humility and the Search for Adaptive Leadership

The most extreme case of hubris in recent memory involved the leaders of Enron. As an Amazon review says, “They make a mockery of conventional accounting practices and grow increasingly arrogant and blind to their collective hubris.” (The Smartest Guys in the Room, Bethany McLean and Peter Elkind). Hubris, from the Greek, defines a sense […]

The post Hubris versus Humility and the Search for Adaptive Leadership appeared first on Jim Highsmith.

Blog post by Jim Highsmith
23 July 2014

Original Link

Part 3 of Collection Pipelines: complex example inverting a many-to-many relationship

I’ve added a more complex example to the article, one that inverts a many-to-many relationship. This also raises the question of how to factor more complex pipelines

Blog post by Martin Fowler
23 July 2014

Original Link

Hacking ThoughtWorks recruitment (Part 3 – Pairing interview)

This is the third article I’ve written on the ThoughtWorks recruitment process (for developers) and today I’m discussing what happens after a coding problem has been reviewed and both TW and candidate are keen to proceed: the pairing interview. Ironically, there are normally three people in our pairing interviews; the candidate, a TW developer who […]

Blog post by Andy Marks
22 July 2014

Original Link