the blog for developers

Comparing Java and Python – is Java 10x more verbose than Python (LOC)? A modest empiric approach

In my last post about “50k lines of code considered large?” I’ve wondered about large code bases and the different perceptions on what a large code base is. I came to the topic because of a blog post: “The Maintenance myth” by Ola Bini. One minor point he makes about maintanence is lines of code in dynamic languages. I know maintanence is mainly about technical debt. But I’m interested in how lines of code factor into maintanence problems. Ola says

“(very large code bases is 50K-100K lines of code in these languages)”

pointing to Ruby and Python. In a reply to a comment from me Ola writes “I would consider 50k-100k in Ruby to be very large, yes, definitely. I know of Python code bases between 100k and 200k, but that’s about the largest I’ve heard of.” With my Java background – and some Ruby and Python background mainly from the 90s – I consider very large applications to be much bigger, perhaps 500k to 1M for very large – not 50k lines as for example SnipSnap has ;-) The Linux kernel contains between 6.4M and 10M lines of code depending on the way you count. There seems to be a huge difference in what people consider very large. There could be several reasons:

  • Python and Ruby are very difficult so smaller code bases are considered very large
  • Python and Ruby are more dense so the same amount of logic can be expressed in lesser lines of code

Considering the second hypothesis the factor should be between 10x (50k compared to 500k) and 20x (50k to 1M) for things people consider very large – taking Ola and his coworkes and me (I didn’t ask my team ;-) as a very small sample set.

Therefor I’ve expressed an example in code. The example is an application fragment for managing songs – the idea coming from the common Ruby introduction. I’ve chosen to compare Python and Java because Python is considered by some people a more mature language and used by larger projects than Ruby and because I did more and bigger projects in Python (my Ruby experience is only some years of coding web applications in Rails and writing an OR mapper and web component framework in Ruby by myself: “Convention over Configuration Framework in Ruby from 2002″). Someone could do a Ruby comparison :-)

People may be surprised, but Java development and style – at least avantgarde – has changed over the last 13 years. So the example might not look like you think that Java should look. It reflects the style I would right now write green field Java code. It is inspired by Domain Driven Design and functional principles (for more about DDD and composite oriented programming in Java see Qi4J and real world Qi4j). In true DDD style I would prefer more objects like Name and Duration - see “Never, never, never use String in Java (or at least less often :-)” – but I’ve cut the example for brevity. Some people would not use a SongList domain object but a List directly. From my point of view, if SongList is a Domain Object and not an implementation detail, you should create a class and not use a List. So I’ve used a list.

A note on formatting: Lately parts of the wave front surfing Java developers switched to one line formatting of small methods, something which helps code readability and understanding a lot (you’ll see). IntelliJ IDEA does support this as a formatting option. It’s a very good feature in IDEA but to my shame I only detected it very late, but glad I did as it’s so much better this way.

For manipulating, filtering and transforming lists I currently use Google collections. For an introduction see here. Google collections make working with lists much easier.

The REST part of the application is missing in Python as I have not enough knowledge to write the code with a state of the art REST framework. Perhaps someone could fill me in. In the Java example I’ve chosen to create the JSON and XML on my own without an automatic mapper. Automatic mappers do exist though, one could use JAXB. The code for the builder is explained in a previous post.

One cautionary note: The only Python books I have are “Internet Programming With Python” and “Programming Python”, the first edition, both from 1996. Sorry that my Python is rusty, all correcting comments or comments on how to do it better are welcome. Please focus on better, not on shorter.

On to the examples:

Java

public class Song extends Entity<SongId, Song> {
  public Property<String> name;
  public Property<Integer> duration;
  public One<Artist> artist;

  public Song(String name, int duration, Artist artist ) {
    this.name = read(name);
    this.duration = read(duration);
    this.artist = read(artist);
  }
}

public class Artist extends Entity<ArtistId, Artist> {
  public Property<String> name;

  public Artist(String name) {
    this.name = read(name);
  }

  public String toString() { return name.get() }

  public Artist artist(String name) { return new Artist(name); }
}

public class SongList implements Iterable<Song≶{
  private List<Song> songs = newArrayList()

  public SongList addSong(Song song) { songs.add(song); return this}

  public Iterator<Song> iterator() { return songs(); }

  public Iterator<Song> filter(Predicate<Song> p) { return filter(iterator(), p); }
}

Some example usage:

// Not counted, as usually the pattern is
// SongList list = ... from Database ... or
// SongList list = ... from UI ...
SongList list = new SongList()
  .add(new Song("S1", 5, artist("A1"))
  .add(new Song("S2", 8, artist("A2"))
  .add(new Song("S3", 13, artist("A3"))

// Print all songs
for (Song song: list) {
  System.out.println( song.name() + " by " + song.artist() + "(" + song.duration() ")" );
}

// Print all songs with duration smaller than 10 (minutes)
final Predicate<Song> durationLowerThan10 = new Predicate<Song>() {
  public boolean apply(Song song) { return song.duration.get() < 10; }
}

for (Song song: list.filter(durationLowerThan10) {
  System.out.println( song.name() + " by " + song.artist() + "(" + song.duration() + ")" );
}

and a simple REST service which returns a JSON or XML (depending on the request) representation of the song list.

// Example REST Service
// Returning JSON and XML to a REST call, without automatic mappers like JAXB
public class SongListResource {
 @Inject ListService service;

 @GET @Path("/songs/{listId}")
 @Produces("text/xml", "application/json")
 public Node getList(@PathParam("listId") String listId) {
   SongList list = service.listForId( listId );

   return $("songs", new List>Song<(list) {
     protected Node item(Song song) { return $("name", song.name() );}
   });
 }
}

The example in Python

class Song:
   def __init__(self, name, duration, artist):
	self.name = name
	self.duration = duration
	self.artist = artist

class Artist:
	def __init__(self, name):
		self.name = name

	def __str__(self):
		return self.name

class SongList
    def __init__(self):
		self.songs = []

	def add(self, song):
		self.append(song)

some example usage

# Not counted, as usually the pattern is
# songList = ... from Database ... or
# songList = ... from UI ...
# Not using SongList, the examples should be the same though
# or not?
songList = [ Song("S1", 5, Artist("A1")),
	Song("S2", 8, Artist("A2")),
	Song("S3", 13, Artist("A3")) ]

for song in songList:
	print "%s by %s (%d)" % (song.name, song.artist, song.duration)

# could provide print method to list
for song in (song for song in songList if song.duration < 10):
	print "%s by %s (%d)" % (song.name, song.artist, song.duration)

A very preliminary conclusion

The example is very short and perhaps not very meaningful. One would need to do more empiric research (e.g. comparing FP to LOC in different languages). And perhaps some readers will provide addtional information. So the conclusion is preliminary and will be updated. Counting the lines of code there are 33 NCSS in Java and 19 NCSS in Python. Java has around 1.7 times the LOC of Python from my example. Taking the hypothesis above this could mean several things:

  • I've written sub-par code and most applications differ significantly in style and are much shorter in Python
  • Code complexity and lines of code arise from frameworks not the language
  • Java is really only 1.7x more verbose than Python, not 10x to 20x

I can't comment on the first conclusion. The second conclusion means, someone would need to compare two framework examples, say the song list in Seam and Django. The third conclusion is very interesting. It would mean that people consider applications written in Python very large although they (relatively) contain a lot less lines of code. Ola considers 50k to 100k very large, with a factor of 2x this would make 100k to 200k of Java lines. I can't speak for most Java enterprise/startup developers, but as I consider 500k to 1M very large, Ola and I differ by a factor of 5x of what very large is. I only can speculate what's the reason for this.

  • This is a personal thing, and different developers have hugely different views on "very large" (perhaps depending on what they have seen)
  • Developers only write small applications in Python and consider everything else "very large"
  • Python is not maintanable above 50k to 100k lines of code and because of that people consider this code bases very large
  • Developers have trouble understanding and refactoring bigger code bases than 50k to 100k lines of code (perhaps because it's a dynamically reference type language)

The first conclusion somehow fits with another quote from Olas post: "And it’s interesting, the number one question everyone from the static “camp” has, the one thing that worries them the most is maintenance.". They may have seen "very large" applications contrary to the "dynamic camp".

"Of course, this is totally anecdotal, and maybe these guys are above your average developer."

I'm glad to provide a step (small one) from the anecdotal to the empiric and from the empiric of this post I don't think people considering 100k of lines "very large" are "above your average developer".

Another side note: "But in that case, shouldn’t we hear these rumblings from all those Java developers who switched to Ruby? I haven’t heard anyone say they wish they had static typing in Ruby." Perhaps because they do green field (not brown field) development? And you need to develop for several years in one application to make it a brown field? And it takes several years to accumulate enough technical dept? Because most of them just started and don't do "very large" applications?

Other interesting stuff:

  • A paper (PDF) from 2000 about Scripting, C and Java comes to the conclusion: "Designing and writing the program in Perl, Python, Rexx, or Tcl takes no more than half as much time as writing it in C, C++, or Java and the resulting program is only half as long." matching the 1.7x factor of my short example
  • Dhananjay Nene wrote a performance post about Python and Java (and some other languages) and the LOC for Java is 86 and for Python 41, a factor of 2.1x
  • Dave rewrote a Java programm to Python from 4700 lines of code to 700 (factor of 6.7x). This would fit more with Olas impression. Not sure how this fits in, the developer can't show the source and it was a rewrite by a different developer. Also counting comments and empty lines, the styles between the developers could differ significantly.
  • Daveh did a comparison, with Python having 214 LOC (not NCSS) and Java 282 LOC (not NCSS). A factor of 1.3x

Lots of open questions and I would be very interested in other opinions and other examples - and to explore the topic further.

Thanks for listening to this very long post.

Update: Ryan (see comments) supplied a version of a function in C and Python and after removing the hand memory allocation code and the Python interface code of the C version, the factor is 2.2x (38 to 17 NCSS). Thanks.

Update 2: Looking at Oloh (see comments) the factor of Java and Python is 4x. Very large base of examples. One would need to check the types of programs.

Update 3: An old article I've found again "7 reasons I switched back to PHP after 2 years on Rails". An interesting info: After going to Rails and coming back, with the Rails knowledge the PHP app was reduced in size "- … and much more. In only 12,000 lines of code, including HTML templates. (Down from 90,000, before.)". Looks like rewrites or prior experience in the domain reduces code size. Could explain Olas experience with Java developers who switched to Ruby. Came to this article again through a comment by Harry Pynn "Point number 7 is that programming languages are like girlfriends: The new on is better because you are better. Could it be that people moving to dynamic languages from static languages find it easier to write maintainable code having honed their skills with a static language?" on Frank Carvers blog.

You can leave a Reply here. Of course, you should follow me on twitter here.

You can share this post!
Do you want to tell others about this article? Use the social bookmark icons to submit this artice to the service of your choice. Thanks.

About the author: Stephan Schmidt is head of development at brands4friends. He has more than 15 years of internet technology experience and 10 years experience in agile. He was head of development, consultant and CTO and is a speaker, author and blog writer. He specializes in organizing and optimizing software development helping companies by increasing productivity with lean software development and agile methodologies. Want to know more? All views are only his own.
Leave a reply.

Comments

Stefan Schubert

Nice approach … though very simple examples. Some of the coding styles you are practising here might not be so common for the casual Java developer. In fact I think that studies on this level are rather academical.

I think this 10x factor comes from comparing historical old Java Code which is actually written by people trying to meet the dead lines to newer, smaller dynamic code bases.

I understand that smaller code needs less people to write and maintain it, which in turn leads to better and smaller code because of less organizational overhead required for smaller teams. That way in reality I would assume that Java code bases are an estimated 5x larger than there dynamic siblings. Because code garbage always leads to more code garbage.

Nevertheless I am preferring Java. My experiences with dynamic languages have much more often lead to trial-and-error programming because so many necessary information are implicit. And if code documentation in a time critical commercial project is so poor as is common in reality those lacking explicits are the only things helping me to fix another guys bug in-place rather than starting to grep the whole code base for missing information.

I think that your examples are OK, but the Python is verbose. I think that in idiomatic Python, the song list would be a Python list, and we’d use a bare string instead of an Artist class. With Python, it’d be easy to change it to an Artist class later if we needed it.

But the real problem with the examples is that they don’t show off the ways that Python can really reduce the line count compared to languages like Java and C++.

One example is polymorphism and the relatively large amount of baggage needed to pull this off in Java/C++ versus Python. Another is the class-ism of Java itself, when bare functions often suffice in Python. Functions as first-class objects eliminate the need for the “command” pattern in many cases; and so on.

I don’t have any hard evidence, but my personal intuition is that C++ is about 5 to 10 times as verbose as Python, when a modern style is used with C++ (e.g. heavy use of the stl/boost libraries, built-in algorithms, smart pointers). I don’t have enough experience with Java to compare.

Dirkjan

I would guess that the gain in number of lines as project size increases more exponential than linear, as you suggest. In other words, the factor obtained for this tiny example script doesn’t fairly represent 10 kLOC projects.

stephan

@Stefan: “Nice approach … though very simple examples. [...] In fact I think that studies on this level are rather academical.”

Yes they are very simple, but I’m no longer in academia and my time is limited. More and bigger examples would be great. The linked paper in the post has examined a larger code base.

It’s the code style I currently use – in private ;-)

stephan

@Dikrjan: Could be the case, that e.g. in Java LOC increases faster with project size than Python (linear vs. exponential), interesting point.

stephan

@Ryan: “I think that in idiomatic Python, the song list would be a Python list, [...]“

Yes could be, as I’ve wrote “Some people would not use a SongList domain object but a List directly. From my point of view, if SongList is a Domain Object and not an implementation detail, you should create a class and not use a List.” I could have used a List in Java too.

“But the real problem with the examples is that they don’t show off the ways that Python can really reduce the line count compared to languages like Java and C .”

Do you have suggestions on how to reduce the LOC in this example – a business style application – go ahead. I’m interested in the best way to write this.

“Functions as first-class objects eliminate the need for the “command” pattern in many cases; and so on.”

I’m not sure how that differs from using Predicate vs. generators in the example code, so I think I’ve already included this into the examples. Perhaps some I should include some more of that?

“I don’t have any hard evidence, but my personal intuition is that C is about 5 to 10 times as verbose as Python, [...]“

I didn’t have any hard evidence either, so I started to create hard evidence.

“I don’t have enough experience with Java to compare.”

I would also be interested in Python vs. C /STL

@stephan

By not showing off ways to reduce the code size, I meant that there aren’t many opportunities in this bit of code. Something more complex would give more opportunities.

But the Python code here can be made shorter (and simpler, IMHO):

class Song:
def __init__(self, name, duration, artist):
self.name = name
self.duration = duration
self.artist = artist
def __str__(self):
return “%s by %s (%d)” % (self.name, self.artist, self.duration)

songs = [Song("S1", 5, "A1"),
Song("S2", 8, "A2"),
Song("S3", 13, "A3")]

for song in songs:
print song

Comparing Python to C and not C++, my subdist[1] function is about 4 times longer in C than in Python — and this is a straightforward function. (Of course, the C version is almost 100 times faster…)

[1] http://pypi.python.org/pypi/subdist/0.2.1

stephan

@Ryan: “Something more complex would give more opportunities.”

Any advice on how to make it more complex in a meaningful way? And make this a better comparison?

(I wanted to reduce the scope to business type web applications, not simulations, flight systems etc. because I really do not know much about them)

stephan


def __str__(self):
return “%s by %s (%d)” % (self.name, self.artist, self.duration)

The same could be done in Java, no difference there.

The for loop was not to print all songs but to show and estimate how Python/Java would do filtering and iteration over a list.

stephan

@Ryan: From looking quite shortly at your subdist C version, there is lots of code like


// Initializes the module
PyMODINIT_FUNC initsubdist(void)
{
PyObject *module = Py_InitModule3("subdist",
subdist_methods,
subdist_doc);
PyModule_AddStringConstant(module,
"__version__",
SUBDIST_VERSION);
PyModule_AddStringConstant(module,
"__author__",
AUTHOR);
}

and


{
return PyFloat_FromDouble(0.0) ;
}

which seems to only be needed to interface with Python or is very verbose (starting { on a new line)

So parts of the complexity seems to come from interfacing with Python not the problem domain.

@stephan:

Ideas to make the code more complex:
* Have different types of songs (favorites, genre, rating)
* Add more objects (albums, play lists)
* Same actions for heterogeneous objects (play method for songs, play lists, albums…)
* Track play counts, user ratings, and play lists, and automatically create play lists based on user preferences (see “Programming Collective Intelligence” for ideas)

I think you’d rapidly find the Java version getting longer than the Python version — assuming you write Python in Python, not Java in Python. :)

When comparing my subdist module, I counted only the code implementing the subdist function, leaving out the boilerplate (92 lines) versus the Python implementation (24 lines).

Here’s the Python version:
http://ginstrom.com/scribbles/2007/12/01/fuzzy-substring-matching-with-levenshtein-distance-in-python/

stephan

@Ryan:

“* Have different types of songs (favorites, genre, rating)
* Add more objects (albums, play lists)
[...]”

I’m not sure how this would change things concerning the LOC factor.

more methods.

“I think you’d rapidly find the Java version getting longer than the Python version — [...]”

Yes it would, by a factor of – 2x – or more, that’s the thing I wanted to find out.

“[...] assuming you write Python in Python, not Java in Python. :)”

Yes that’s what I’ve tried to do and asked to correct me.

Taking the Pyhton version of the algorithm I can’t see how the Java version would differ much in LOC, I’d rather think the factor is below 2x (from my stomach).

Maybe a better comparison is to take two applications targetting the same field, say the Mercurial revision management system written largely in Python, and something else in Java. Or the Django Web framework and a Java Web framework then compare lines of code.

By having two examples that both use classes for example, you might miss out a none-class based Python idiom. By saying something must be solved in a particular manner, then you miss out on differences due to language culture.

- Paddy.

stephan

After checking the C version of in more detail, I looks that it’s much longer than the Python version due two memory management, lots of opening { in one line and not having a min version on arrays (I’m no C expert any more but I’d think there is a library to make working with arrays easier and not reimplement the array manipulation code).

After removing the memory managment part and the Python interface part it’s 38 lines of NCSS in C and 17 lines in Python – a factor of 2.2x – very much like the 1.7 of my experiments.

Otherwise when implementing memory managment of arrays on your own instead of reusing libraries, the factor could approach the 4x you’ve mentioned.

Maybe java developers – especially in large java projects – have a high tolerance for boilerplate code? This is my personal hypothesis. That large java projects contain enormous amounts of boilerplate.

-Anders

Sergey Lipnevich

I believe that not taking into account things like reuse of libraries, including the standard runtime that comes with each environment, renders a lot of the “facts” meaningless.

Design and algorithm choices are also significant, further complicating the comparison.

I’d like to offer a different approach: measuring unit-tested lines of code, and including the unit tests’ LOC metric itself into the final LOC, potentially weighted and adjusted somehow using coverage percentage. To mimic the original LOC metric, the “new” final metric must be higher if coverage is lower (for fixed LOC and unit-test LOC), and again higher if unit test code LOC is higher (with fixed LOC and the same coverage). If unit test LOC and coverage are the same, the metric would of course be higher if main LOC is higher.

e.g. LOC-like metric = LOC / coverage unit-test LOC

Having said that, I believe Python will win if a metric like this is used because with Python it’s much easier, generally, to achieve 90% test coverage (by statements, not branch points), as opposed to Java or C#’s 50%-70%.

@stephan:

For example,


class Song(object):
def __init__(self, name, duration):
self.name = name
self.duration = duration
def play(self):
print "Playing single song: %s (%d min.)" % (self.name,
self.duration)

class Album(object):
def __init__(self, name, songs):
self.name = name
self.songs = songs
def get_duration(self):
return sum(s.duration for s in self.songs)
duration = property(get_duration, doc="Duration of album")
def play(self):
print "Playing album: %s (%d min.)" % (self.name, self.duration)
for song in self.songs:
song.play()

if __name__ == "__main__":
album = Album("Album 1",[Song("A1", 5), Song("A2", 3)])
playlist = (Song("B", 4), Song("C", 4), album)
print "Total playing time: %d minutes" % sum(i.duration for i in playlist)
print "=" * 30
for playable in playlist:
playable.play()

I expect that would be more than 1.7x longer in Java.

stephan

@Ryan: Thanks, I’ll add this to the example next time. I plan to do an update.

stephan

@Paddy3118: Yes, would be a better comparison but it’s hard to find such 2 applications with the same amount of FP.

@Anders: “Maybe java developers – especially in large java projects – have a high tolerance for boilerplate code? This is my personal hypothesis. That large java projects contain enormous amounts of boilerplate.”

Maybe. Then it’s more a “Java developer” thing not a Java thing?

@Sergey: “Having said that, I believe Python will win if a metric like this is used because with Python it’s much easier, generally, to achieve 90% test coverage (by statements, not branch points), as opposed to Java or C#’s 50%-70%.”

Not sure, I’d rather think you need less Unit code because of the more strict compiler in Java. And there should somewhere slides written by me on how to achive 100% test coverage in Java and why you should do that.

Comparing Easyb and RSpec for example, I don’t see RSpec to be much shorter in it’s specifications.

Sergey Lipnevich

Apologies, the plus sign was eaten during submission. the formula I had in mind should be

Unit-test adjusted LOC = LOC “divided by” coverage “plus” unit-test LOC

Stefan, I’m sorry but unit tests never replace compiler features so saying that one need less unit testing because you have a stricter compiler is akin to saying that cars made of a better grade steel require less testing. These two things are orthogonal. Also, the key is not in achieving 100% coverage, but achieving it in reasonable time and with reasonable effort. From my experience, in Java (and C#, which I prefer to Java these days), 80% coverage is a gold standard that you have to work very hard to attain and almost nobody ever does, while in Python 80% is routine. I wish Ohloh tracked this so that my statement could be verified at least for FOSS projects.

BTW, here’s another number to play with, courtesy of Ohloh. As of today, average LOC per project for Python is 12,021 LOC/project (52,123,133 LOC for 4,336 projects), while for Java it’s 49,276 (245,987,375 LOC for 4,992 projects), suggesting that Java is four times more verbose.

http://www.ohloh.net/languages?query=python
http://www.ohloh.net/languages?query=java

Sergey Lipnevich

Should have spelled the name correctly, my apologies, Stephan!

stephan

@Sergey:

“Should have spelled the name correctly, my apologies, Stephan!”

NP, I’m used to that ;-)

“I wish Ohloh tracked this so that my statement could be verified at least for FOSS projects.”

Excellent idea.

“[...] suggesting that Java is four times more verbose.”

Or suggesting people only do smaller projects in Python – like there are several large app containers in FOSS Java but less in Python (from my knowledge).

Or suggesting people in FLOSS Java projects write exceptionally – not comparable to enterprise systems – bad code.

This could be a real reason for Java problems though (and more lines of Code in an average enterprise Java project): Python developers are more skilled than the average Java devloper.

But that’s not what the cited LOC examples show.

Sergey Lipnevich

“Or suggesting people only do smaller projects in Python.”

It’s the same thing as saying that Java is more verbose I believe: requiring more code to achieve the same goals. There’s a “macro” parity in FOSS functionality for Python and Java: both have everything from IDEs, trading, and project management applications to application servers, RPC and GUI, Web, ORM, networking and XML frameworks. Both languages are mature, have standards (PEP and JSR), conferences, user groups, and book authors.

“Or suggesting people in FLOSS Java projects write exceptionally – not comparable to enterprise systems – bad code.”

It’s a fallacy to attribute bad code only to developers and not to programming language they write in; both are involved, to a different extent. I feel btw that the code quality gap in enterprise systems (that I happen to be building) vs FOSS is greatly exaggerated, there’s plenty of variability in code quality and skill levels everywhere, so I wouldn’t give Java a break because it’s more popular in the enterprise than Python. Also, following this logic (enterprise code is better than FOSS code), if Python acceptance in the enterprise grows, which I think is happening, then the gap in verbosity will widen in Python’s favor as more developers start using it at their jobs.

Let me illustrate the point about bad code and its language. Assuming we consider duplicated code bad, Python, unlike Java, allows defining local functions to eliminate duplication. Java almost allows that, if you’re determined, by using an anonymous inner method, *but* you have to defining an interface for it in advance. The killer move however is that Python allows those local functions to access and modify local scope, again unlike Java. Taking this example back to our discussion of verbosity, in Java one would recognize the need for additional encapsulation, define a new class, and use it, adding more boilerplate code in the process. Instead of one local function in Python we in Java now have a separate class with initialization and properties (to pass the state in and out), just to implement the same idea. Although this is a gross generalization, Java seems to punish better design choices by requiring a lot more code to implement them.

“But that’s not what the cited LOC examples show.”

I’m afraid these, or any other, specific examples can’t be used for anything but illustration purposes. If you’re determined to calculate the “verbosity ratio” of /languages/ and not just /examples/, you have to consider widest representative sample (within reach, of course) of knowledge accumulated for each programming language in question.

stephan

@Sergey: What you write is your hypothesis on “Java is 4x larger than Python because Oloh says so and I assume from a quick check that the projects are the same”.

It would be nice to really check the projects, take some, check their FP as I’ve said and make it an empiric approach.

My blog post was especially about putting facts into myths. And though it was a small step with a limited result, it was about facts.

“Assuming we consider duplicated code bad, Python, unlike Java, allows defining local functions to eliminate duplication.”

Java allows do define inner classes as shown in the example. Go read the blog post!
The inner class in the post uses 3 lines of code, compared to 1 line of code for a Python function definition. When writing inner classes in one line as some people do, it’s 1:1. But assuming all the code is nothing but inner classes vs. function definitions, the factor would be 3.

“Instead of one local function in Python we in Java now have a separate class with initialization and properties (to pass the state in and out), just to implement the same idea.”

Sorry, no, read the blog post.

“The killer move however is that Python allows those local functions to access and modify local scope, again unlike Java.”

Inner classes have access to local scope.

Right now what you do is in no way empiric but lots of hand waving.

“I’m afraid these, or any other, specific examples can’t be used for anything but illustration purposes.”

What you say is: Sorry you can’t do an empiric approach, all we can do is have myths, do hand waving, write long arguments without facts? Sorry, I’ve been to much a scientist in my life to accept that.

So do say anything about anything, you need to look at everything? Sorry, it doesn’t work this way.

Sergey Lipnevich

My empiric approach is different from yours because I try to look at macro-metrics, such as those provided by Ohloh, to draw conclusions about macro-issues (verbosity in Java vs Python). You prefer to look at small examples (not even small projects). If you stick to it, you’ll either have to write about a thousand (or even a million) more examples, or drop the generality of your claims.

The numbers I cited are facts, and are quite difficult to dispute because their measurement methodology is open and available for review. The example I conjured may not be the best for you but my point was that programming language is partially responsible for bad code, would you like to argue against this statement? Or would you like to reverse your claim that enterprise code is better than FOSS code (which, combined with growing Python popularity in the enterprise, would mean that 4:1 verbosity rate of Java will only worsen)? I believe I stayed away from anything you describe as “myth” as I agree with you that hand-waving in such matters will not advance state-of-the-art of our profession.

Finally, last time I checked, anonymous classes were allowed access only to final variables outside of their definition scope, and were therefore significantly different from Python’s local functions. If this changed, I agree that the example I provided is obsolete, but if not, I stand by it.

Duck Typing (http://en.wikipedia.org/wiki/Duck_typing) cuts down on both code size and makes simple code line coverage metrics in Python easier. As you have larger requirements then their becomes more scope for using Duck typing.

- Paddy.

Isaac Gouy

> There seems to be a huge difference in what people consider very large.

If the largest program you’ve worked on is 100 lines then 1000 is very large.
If the largest program you’ve worked on is 1000 lines then 10000 is very large.
If the largest program …

The only way to escape that parochial ignorance is to look at the research on software projects:

“Applied Software Measurement”
http://www.mhprofessional.com/product.php?isbn=0071502440

> A paper (PDF) from 2000 about Scripting,

Note that the Java, C, and C programs in the Prechelt’s study were created as part of a controlled student experiment but the Perl, Python, Rexx, and Tcl programs were created by self selected volunteers from newsgroups – are the people doing the work of similar experience?

> Java has around 1.7 times the LOC of Python from my example.

For tiny programs we could just check the benchmarks game

http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=all&xfullcpu=0&xmem=0&xloc=1&binarytrees=1&chameneosredux=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=1&nbody=1&pidigits=1&regexdna=1&revcomp=1&spectralnorm=1&threadring=1&calc=calculate

stephan

“The numbers I cited are facts, and are quite difficult to dispute because their measurement methodology is open and available for review. ”

I don’t think it makes sense to argue the point any more. What you did was a quick glance at oloh. You didn’t look at the FP of the apps, count and categorize the type etc. all I responded in my first reply.

“Or would you like to reverse your claim that enterprise code is better than FOSS code [...]”

I didn’t make any such claim, I was mentioning thoughts about other reasons for the result you’ve got. This is called science. I think going to Oloh was a good idea, but comparing 4000 Python projects with 4000 Java projects without looking at the type of those won’t work.

“Finally, last time I checked, anonymous classes were allowed access only to final variables outside of their definition scope ”

1.) How is accessing a final variable not accessing a variable?
2.) How is accessing an attribute (object or class scope) not accessing local scope?

This is Java 1.1 or – rough guess – more than 10 years in Java.

stephan

@Paddy: “Duck Typing (http://en.wikipedia.org/wiki/Duck_typing) cuts down on both code size and makes simple code line coverage metrics in Python easier.”

Show me how.

I’d think it would reduce the numbers of characters but not lines of code.

@Isaac: I will look into the shootout examples, good idea.

Interesting post stephan. My experience in writing Groovy is that Groovy code is typically around 60% less verbose than Java code. But your point about the framework is valid, for example writing a web app in Grails is about 1000% less verbose than Servlets EJB 2, but maybe only 50% less than Wicket :-)

Of course 77% of statistics are made up on the spot ;-)

Regarding Paddy’s point about duck typing, the major area where it reduces code is when you have code like:

def doWork(worker) { worker.work() }

Here you can pass any object in and work can be performed as long as there is a work() method. In Java you would have to have a Worker interface or something and then every time you needed a new worker you would need to create a new class. Yes sometimes an anonymous inner class will do, but sometimes not.. in the end there are occasions where static typing forces code bloat.

That is at least my experience with developing Java vs Groovy/Javascript/Ruby/etc. As for large projects, yes I think Java developers are more used to large projects. I’ve worked on two projects that were both well over 1 million lines of code. However, looking back at those projects one thing I would say is that Java developers have a tendency to glorify their own egos by over engineering things.

For example introducing layers upon layers of abstraction that really aren’t necessary because “one day we might need to change this or make it configurable”. People who use languages like Ruby/Python/etc have a more GTD attitude and maybe that results in less maintainable “hacked together” code, but then again I think there is a balance between productivity and good engineering practise that I think either side don’t always get right.

Sergey Lipnevich

Wide Finder is another interesting source of code written in many different languages for the same well-defined task: http://www.tbray.org/ongoing/When/200x/2007/10/30/WF-Results. It’s similar I suppose to Computer Language Benchmarks Game because the constraint was to maximize performance, not minimize LOC.

“This is called science.”

Now /this/ is called hand-waving. Sorry, dude.

Stephan – You can see for yourself:

Create a Java program with a method that takes a message and a file opened for reading and adds some extra formatting to the message and prints the result to the file.

In idiomatic Python, that might be:

def writer(msg, outfile):
….outfile.write(“formatting:” msg)

def use_writer1():
….msg = “Howdy”
….out = file(“ofile”,”w”)
….writer(msg,out)

use_writer1()

If, at some later date, you need to return the formatted text as a string, what would you need to do in Java? how much of your current program would need editing? What if you decided that use_writer1 threw an exception that you now wanted to catch, what then?

To capture the formatted output as a string in Python would need no change to function writer (in this case it is a small function, but it could be much larger).
It would be used as follows:

def use_writer2():
….from StringIO import StringIO
….msg = “Howdy again”
….out = StringIO()
….writer(msg,out)
….print out.getvalue()

I pass in a sufficiently file-like object to writer() that captures what is writen in a string accessed later by its getvalue method.

If I decide to capture an exception raised within writer(), I just enbed the call to writer in a try/except block – again without having to change the definition of writer().

You would have to do the exercise in Java to wiork out comparative code sizes, but you should also see that code becomes more maintainable as less might need to be changed to accommodate later spec. changes.

- Paddy.

An article I wrote a while ago on the subject of LOC etc: “AganeAndAgane – Supporting Repetitionism in the Enterprise” at http://www.1729.com/blog/AganeAndAgane.html

stephan

@Graeme: “However, looking back at those projects one thing I would say is that Java developers have a tendency to glorify their own egos by over engineering things.”

Very good point. Yes I think that’s true.

@Philip: I’m not sure I’ll get your post, but I try :-)

stephan

@Paddy: From reading “Implementation patterns” and my feeling I probably won’t do

def writer(msg, outfile):
….outfile.write(”formatting:” msg)

because the objects involved are semantically on a different level (formatting and IO).

“To capture the formatted output as a string in Python would need no change to function writer.”

The Java code wouldn’t need to change either. So I’m not sure what your point was.

I’m not sure how StringIO differs from StringWriter ?

http://java.sun.com/j2se/1.4.2/docs/api/java/io/StringWriter.html

StringWriter out = new StringWriter()
write(msg, out)
String value = out.toString()

Which probably has been much longer in Java (Java 1.1, 1997) than StringIO is in Python, and from the naming it looks more like Python was “inspired” by Java. But that’s beside the point of comparing LOC and may be a wrong assumption on my side.

Stephan,
StringIO or whatever does not have to inherit from File. Its the point of Duck Typing. As your program grows, you don’t have to create inheritance hierarchies to solve this kind of problem.
I guess you have to embrace Dynamic language techniques rather than write Java in Python before you can understand some of the trade-offs.

- Paddy.

[...] Comparing Java and Python – is Java 10x more verbose than Python (LOC)? A modest empiric approach at… [...]

So in summary: You are saying that because Java _only_ requires 1.3-4.0x the LOC of other languages that it’s better suited for “large” applications?

I see one problem with your logic. Most “large” java applications have tons of support properties files (because java is static) and other large sets of XML to just get the beast off the ground. I tend to agree with Ola that it’s more like 8-10x LOC.

After 10 years of slogging through Java I would never do another Java language project. JVM: sure. Java: no.

stephan

Tim: Please stop commenting on this blog. The only reason for you to comment is to create trouble and not have any content beside “I’m right and you’re wrong”. Please stop before this thread gets out of hand as the other one did were I did need to shut the comments because of your accusations.

Chekke

PHP 5 is also not so verbose as Python and familiar for Java folks.

class Song {
function __construct($name, $duration, $artist) {
$this->name = $name;
$this->duration = $duration;
$this->artist = $artist;
}
}

$songs = array(new Song(“S1″, 5, “A1″),
new Song(“S2″, 8, “A2″),
new Song(“S3″, 13, “A3″));

foreach($songs as $song) {
echo $song->name, $song->duration, $song->artist;
}

Chekke

Tim the rubbist, All the ruby folks are the same, they think are the best of the best but that is not true, Ruby have a lot of flaws also, Actually is an ugly language compared with Python, Me I recognize Python is the best syntax I have seen, I did little bit Ruby before but I went back to Java and PHP. With PHP I can do more and scales well see Facebook for example. What about Ruby?, It seems is just a toy and always will be that just a toy language.

stephan

Chekke: Please don’t flame the debate, I wanted to keep it empiric and not heated. Thanks

Chekke

Ok Stephan sorry.

paulo

The only things that java needs and can’t get are left overs from bad initial decisions, in both the std library and the language. In not even going to mention closures, but do you know why implicit method class wrapping (how java would probably do function pointers) wasn’t even considered? I believe it was both a combination of Classes are everything mentality (it’s ok, i would LIKE to see them implicitly converted to (nameless) 1 function interfaces) and boneheadead things, like at the start of the language the decision to make the valiables namespace and the function namespace different, so that variables could have the same name as functions.

What is wrong with the decision above? VARIABLES SHOULD NOT HAVE THE SAME NAME AS FUNCTIONS!

Besides now there is no way in hell of a possible.
addActionListener(this.function);

Possibly this or similar would be enough.
addActionListener(this->function);

Want to revitalize java? Implement a Scala like structural typing, add a kind of versioning that allows interfaces and all its implementers to be updated/ or BREAK THE FUCKING STANDARD LIBRARY

Yeah, I definitely think it is a Java developer thing, as much as it is constraints of the language.

Because one can compress Python wonderfully one has incentive to try. Because it is harder to compress Java, there is less incentive to try.

-Anders

Paul King

One thing I have tried in the past for comparing verbosity of programming languages is to use stats from PLEAC (pleac.sf.net). That has the examples from the Perl cookbook in other languages. While it is by no means a perfect measure it gives a general trend. Typically Python comes in with the smallest number of lines of code (no closing brace or closing end to worry about – at the tradeoff of having whitespace requirements). Groovy and Ruby come in just behind that as does Perl. Haskell then not too far behind etc.

If you want a very crude check yourself, just find a chapter that is completed 100% for the languages you are interested in and count the total number of lines in the solution file for that chapter.

It isn’t a perfect comparison though. Just as one example, Groovy (and I guess the same would be true of Ruby) probably does builder code very compactly due to its inherent builder support but the Perl cookbook examples predate common usage of builders. Similarly, Haskell probably does certain kinds of recursive functions more compactly than other languages but again, such examples might be less representative in a Perl cookbook.

Also, I know in the Groovy solutions, I have used more comments that in some of the language solutions but less than some of the language solutions. I also frequently gave multiple Groovy solutions to a problem if there were several interesting ways to solve the problem in Groovy. This probably makes the Groovy numbers worse than they would be if I only gave one solution.

Finally, language evolution biases the numbers. Most of the Groovy solutions are based on Groovy 1.0 (though sometimes I have given 1.0 and 1.5 solutions). Most of the Java versions are based on Java 1.4 etc.

Never-the-less, you can get some interesting results. An observation for me is that there is far more commonality in the solutions than differences. Perhaps that is a humbling reminder that although we might all have language preferences, at the end of the day, there are many other languages which are probably just as good depending on people’s backgrounds, skillsets, available tools etc.

Paul.

stephan

@Paul: Thanks a lot for the very good idea. I’ll look into PLEAC.


* Python and Ruby are very difficult so smaller code bases are considered very large
* Python and Ruby are more dense so the same amount of logic can be expressed in lesser lines of code

There is a third option. Scripting languages have a strong presence on Unix like platforms where good style is to use several programs that do one thing well; connected by, for example, pipes; rather than have one large monolithic program.

- Paddy.

stephan

@Paul: I think I have “Groovy in Action”, is was this written by you? :-)

@Paddy: “There is a third option. Scripting languages have a strong presence on Unix like platforms where good style is to use several programs that do one thing well; connected by, for example, pipes; rather than have one large monolithic program.”

But taken those programms together (“the same amount of logic”) the LOC would be the same, wouldn’t it (assuming DRY). Or could you reduce LOC by splitting a DRY moniloth into smaller programms? I would assume LOC even increases?

Paul King

@Stephan: Glad you liked “Groovy in Action”.

Just for fun, here is a reasonably compact version of the Songs example in Groovy:

class Song { def name, duration, artist }
class Artist { def name }
def song(sn, d, an) { new Song(name:sn, duration:d, artist:new Artist(name:an)) }
songs = [song("S1", 5, "A1"), song("S2", 8, "A2"), song("S3", 13, "A3")]
printSong = { s -> println “$s.name by $s.artist.name ($s.duration)” }
songs.each(printSong)
songs.findAll{ s -> s.duration < 10 }.each(printSong)

You could certainly shrink it below 7 lines but this felt a reasonable compromise.

Alternatively, you can add static typing and annotations, e.g.:

@XmlRootElement
@XmlAccessorType (XmlAccessType.FIELD)
class Song {
@XmlElement String name
@XmlElement int duration
@XmlElement Artist artist
}

@Path (“/songs/{listId}”)
class SongListResource {
@GET @Produces(["text/xml", "application/json", "application/atom"])
Song getSong(@PathParam(‘listId’) String listId) {
SongList.songs[listId as int]
}
}

And drop it in an app server and you have JSON, XML and Atom output ready to go.

stephan

Thanks for the Groovy example.

I’m not a fan of JAXB type XML annotations, my feeling is they work for simple examples but don’t scale.

Paul King

You can do whatever you want of course. Roll your own if you want complete control:

@GET @Produces(“text/xml”)
String getSong(@PathParam(‘listId’) String listId) {
def s = SongList.songs[listId as int]
def sw = new StringWriter()
new MarkupBuilder(sw).song{
name(s.name)
duration(s.duration)
artist{ name(s.artist.name) }
}
sw.toString()
}

Or use XStream (with or without annotations) or Aegis, XmlBeans, Castor, one of the Atom or JSON libs etc.

stephan

Yes, I like Groovy builders, bad that they are not available in Java.

I wrote about markup builders before:

http://stephan.reposita.org/archives/2007/11/30/the-best-markup-builder-i-could-build-in-java/

XStream, XmlBeans etc. are all serializing technologies. And they make it hard to serialize data in different ways, depending on context (user, server, time, version, …). So explicit builders work better I think.

Paul,

Groovy isn’t statically typed when you add type annotations. It’s just not duck typed when you do that. Groovy type annotations are contracts that are checked at runtime – conceptually similar to writing “assert(value instanceof Clazz)” in Java.

Obligatory Scala post:

case class Artist(var name : String) {
override def toString = name
}

case class Song(var name : String, var duration : Int, var artist : Artist) {
override def toString = name + ” by ” + artist + “(” + duration + “)”
}

// some sample usage
val list = List(
Song(“S1″, 5, Artist(“A1″)),
Song(“S2″, 8, Artist(“A2″)),
Song(“S3″, 13, Artist(“A3″))
)

list foreach println
list filter (_.duration < 10) foreach println

Paul King

@James: Agreed, I wasn’t using rigorous terminology in the descriptions of my examples – not as a sly means of miscommunicating – simply as a simplification of a potentially complex topic. I am not sure using the term ‘type annotations’ helps clarify things though as annotations is already an overloaded term in Java (and hence Groovy).

That said, I do think it is a worthwhile endeavour to find better ways to clarify Groovy’s hybrid static/dynamic type system. Many times the differences between a static type system, a dynamic type system and a hybrid type system (like Groovy’s) simply don’t matter but there are certain kinds of question one might ask where it can make a big difference. I guess the safest bet with Groovy is to think of it as mostly a dynamically typed language (even when ‘type annotations’ are in play) but there are some things which are strictly static. I hope over time with Groovy’s evolution we can both stretch the language to cover various static and dynamic scenarios but also clarify exactly what the consequences are of your choices.

On the whole, I have grown to appreciate the balance that Groovy gives me in terms of the expressiveness and power it gives me vs the ability to reason about my code. There are times though when I think Java, Scala, Haskell or a myriad of other languages also have much to offer.

The term “ype annotation” predates “annotations” in Java by decades.

Groovy is never, ever statically typed. It is always dynamically typed. It is not hybrid typed. It’s just not always duck typed, that’s all.

watch

groovy:000> def foo() {
groovy:001> int x = 3
groovy:002> x = “hello”
groovy:003> }
===> true

So it accepted that definition of foo, even though it’s guaranteed to fail. Not statically typed.

groovy:000> foo()
ERROR org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘hello’ with class ‘java.lang.String’ to class ‘java.lang.Integer’

It puked when I tried to execute it. Dynamically typed.

Oddly enough, Java is (technically) hybrid typed. It has both a static and a dynamic type system. It’s just so painful to use its dynamic typing features that people don’t think of it that way. For languages that are truly and usefully hybrid typed see Boo and Fan.

In the meantime, please stop saying Groovy is statically or hybrid typed.

Paul King

@’type annotations’ predates Java by decades: yes it does but most of the programming audience don’t. So, depending on the audience it may add clarity or not.

@’Groovy isn’t statically typed when you add type annotations. It’s just not duck typed when you do that.’: Hmmm …. I guess I’ll need to see your definition of duck typing to see if this sentence aids clarity in my mind. Maybe it is better to think of duck typing as always on. Just whether there is polymorphism based on Object vs some other class? I guess the key thing being that a dynamic method lookup with multimethod dispatch is always in place with as you say cast checking at runtime to ensure type safety (albeit at runtime).

@’… So it accepted that definition of foo, even though it’s guaranteed to fail.’: well in general it isn’t guaranteed to fail in a dynamically runtime system. Though perverse, consider this:

Date.metaClass.constructor = { -> 42 }
int x = 3
x = new Date()
===> 42

@’please stop saying Groovy is statically or hybrid typed’: let me try this:

import javax.servlet.http.*
class Foo implements HttpSessionListener { }
println Foo.class

Oh look …

Exception thrown: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script9: 1: Can’t have an abstract method in a non-abstract class. The class ‘Foo’ must be declared abstract or the method ‘void sessionCreated(javax.servlet.http.HttpSessionEvent)’ must be implemented.

… so when defining types, there are places where Groovy currently honours static typing. We may make this example more dynamic in the future and in other places we may allow more static type checking but at the moment it is some kind of hybrid.

It is certainly valid to debate whether the places where Groovy falls back to static checking are useful. The current thinking is that interface-oriented programming is a concept that Java programmers are familiar with so providing static checking around them is in line with Groovy’s goals of close integration with Java.

Hmmm, that is interesting. I’ll take it back, then. There are some areas where Groovy is statically verifying semantic constraints. That does seem a rather curious thing given the dynamic nature of Groovy – after all, couldn’t I monkey patch in a concrete implementation of the HttpSessionListener methods later in the code?

But I still stick by the contention that the original example of using type annotations doesn’t make code statically typed.

Paul King

@James: one can monkey patch in both the methods and the interface at runtime in a number of ways, e.g. one way is:

import javax.servlet.http.*
def listener = { println ‘do nothing’ } as HttpSessionListener
assert listener instanceof HttpSessionListener

Here the same static check will be made on the dynamically created class. One can also monkey patch in the methods without the interface in which case you would be relying on duck typing. You could make a chicken typing equivalent to instanceof called say respondsToAll using the built-in respondsTo method.

Your second statement is true – though there have been many proposals to enhance Groovy to even allow hybrid behavior in that case, e.g. using compile-time metaprogramming (aka AST macro):

@Static
int x = ‘hello’

which would bypass many of the dynamic lookup mechanisms and allow compile time checking.

But such a change is very significant and no proposal has been accepted yet – you simply write your foo() method in Java for the time being – given that the syntax is so close between the two languages, this a quite palatable workaround.

sivalr

Ignore groovy for god sake!!! It’s terribly slow.

Java (even with more LOC) is faster than Python. But Python does job with lesser LOC than Java for achieving any given task. From my experience, I can tell that python LOC will be atleast 3X lesser than equivalent Java LOC.

So the best way to attack any problem is to code in python and then change the slower parts of code to C++

Currently, Python is the best language in the world. Ruby is for people who like vast syntax and short-cuts. Java is good but too much verbose (topic context).

Also, python web frameworks and ORM’s are much superior than any thing exisiting in Enterprise realm.

Two questions for all of you:
1) “”"Do u want to get work done faster and cleaner?”"”
2) “”"Do u want to spend more time on solving problem requirements rather than syntax?”"”

My Final verdict(ur free to disagree):

–>Stop any discussion and start coding in python. Python is simply the best.

Paul King

@sivalr, you probably haven’t used a recent version of Groovy. Groovy gives you all the succintness of Python but with a Java flavor and you can harness as much of Java’s speed as you need.

@stephan

But taken those programms together (”the same amount of logic”) the LOC would be the same, wouldn’t it (assuming DRY). Or could you reduce LOC by splitting a DRY moniloth into smaller programms? I would assume LOC even increases?

You try and use other programs to do specialised parts of the job e.g. a graph drawing utility for graphs. You also gain in that it is easier to test two smaller programs compared to one monolithic program doing the same thing.

- Paddy.

stephan

“You try and use other programs to do specialised parts of the job e.g. a graph drawing utility for graphs”

So it’s not about splitting, but about reuse? I won’t argue with that, reuse can reduce the LOC.

Yang Nguyen

Sorry for nick-picking and digging an old post but I think you mistook at the first paragraph: “maintanence” –> “maintenance”

@Yang: No nick-picking, fixed the typos, thanks, appreciated.

Anonymous

“What you say is: Sorry you can’t do an empiric approach, all we can do is have myths, do hand waving, write long arguments without facts? Sorry, I’ve been to much a scientist in my life to accept that.”

There are studies that indicate that OOP provides worse productivity than procedural programming. There are not studies that indicate the reverse. So you are using a non-empiric approach all the time. (Productivity gains from Java over C come from the automatic memory management and the bigger library. Not from OOP.)

@Anonymous: Could you point me to some of those studies? Were they about green or brown field development? I’d assume productivy is higher in procedural langiages with green field development. Brown field might be harder. Not sure though, what did they write?

Well, this is what I see now writing software in Java and Python.

One thing not mentioned here: tests. In Python you have to test much more, in Java many tests are done by compiler.

Leave a Reply

What people wrote somewhere else:

Additional comments powered by BackType

Guide to CodeMonkeyism

Over the last 4 years I wrote many articles on this blog. To make it easier for you to find the relevant ones, I've organized them into topics.

Top 10

6 reasons why my VC funded startup did fail

Go Ahead: Next Generation Java Programming Style

Java Interview questions: Write a String Reverser

The dark side of NoSQL

7 Bad Signs not to Work for a Software Company or Startup

Is Java dead?

Scala vs. Clojure

Never, never, never use String in Java

No future for functional programming in 2008 – Scala, F# and Nu

Clojure vs Scala, Part 2

Java Developer

Is Java Dead?

Go Ahead: Next Generation Java Programming Style

Be careful with magical code

All variables in Java must be final

Never, never, never use String in Java

Bending Java: More readable code with methods that do nothing?

NoSQL Guy

NoSQL: The Dawn of Polyglot Persistence

The dark side of NoSQL

Essential storage tradeoff: Simple Reads vs. Simple Writes

Sharding destroys the goals of your relational database

The unholy legacy of databases

Startup/CTO

Development Dream Teams

6 reasons why my VC funded startup did fail

American vs. European style of Software Development

12 Things to Reduce Your Lead Time and Time to Market

The high cost of overhead when working in parallel

Essential storage tradeoff: Simple Reads vs. Simple Writes

Job Seeker

Another Good (Java) Interview Question

7 Bad Signs not to Work for a Software Company or Startup

Java Interview questions: Write a String Reverser (and use Recursion!)

Java Interview questions: Multiple Inheritance

As a Manager: What I value in developers

Top 10 Tips (+1) to Get a Pay Raise

Agilist

What Developers Need to Know About Agile

5 Practices Better to Change in Your Scrum Implementation

Scrum is not about engineering practices

ScrumMaster and ZenMaster: The joke of certification

What is Trans-Scrum?