When it comes to code, less is more

how-to
Jan 27, 20092 mins

Fewer lines of code can result in a quicker time to market with fewer defects. But reuse is important not only because it means writing less code, but also because it means leveraging what you could call the “wisdom of crowds.” Popular open source frameworks and tools — such as Hibernate, Spring, and JUnit — are being used by a multitude of people across the globe in varying applications. This battle-hardened and tested software isn’t defect-free, but you can safely assume that any issues that do arise will be found and fixed swiftly and at no cost.

As such, the hip Apache Commons Lang project has been around for years and is stable. The latest release contains roughly 90 classes and almost 1,800 unit tests. Although coverage information isn’t published (and certainly one could argue that this project could have low code coverage), the numbers speak for themselves. That’s essentially 20 tests per class. I’m willing to bet that the project’s code is at least as well tested as yours, man.

By using Commons Lang, you’ll end up writing less code, which lets you deliver production-ready software faster and with fewer defects. This hip tutorial, published by IBM developerWorks, entitled “Stop writing so much code!” guides you step-by-step through the fundamental concepts of using a few different Commons Lang classes and leveraging their code so that you don’t have to write so much of it yourself.

Want to learn more about Groovy and Grails? Then sign up for ThirstyHead’s Jump into Groovy and Grails course!

Think easyb is the coolest thing since sliced bread? Then come to my

BDD with easyb

course too!

andrew_glover

When Andrew Glover isn't listening to “Funkytown” or “Le Freak” he enjoys speaking on the No Fluff Just Stuff Tour. He also writes articles for multiple online publications including IBM's developerWorks and O'Reilly’s ONJava and ONLamp portals. Andrew is also the co-author of Java Testing Patterns, which was published by Wiley in September 2004; Addison-Wesley’s Continuous Integration; and Manning’s Groovy in Action.

More from this author