wtorek, 4 października 2011

Is software development akin to ice cream making?

Surprisingly much more than could be suspected.
As nicely explained by Martin Fowler on his blog here, famous ThoughtWorks "stole" its operation model from a ice cream company. He describes the model as founded on three pillars. They're as follows:
1. Sustainable Business - this one is fairly obvious and boils down to "you need money to survive in business". However, one special thing is noted by Martin: "revenue is like oxygen - you need it in order to live but it isn't what you live for". I like it :)
2. Professional Excellence - seems to be obvious as well. One should always strive to do the best possible job. What's interesting, Martin argues that this sometimes involves *not doing* what customer wants. Particularly, he elaborates about features that don't pass their (internal!) usefulness evaluation. Now this is something different than I've experienced! Additionally Martin claims this pillar includes improving not only how his company works, but also the industry as a whole. He believes that if his company invents/finds something interesting or makes a breakthrough, it should share. My belief is that some *big* IT companies could benefit from this pillar a lot.
3. Social Justice - contrary to the first impression this not about giving out stuff for free ;) It's rather another incarnation of (in)famous Google phrase "don't be evil". Martin's explanation here is that a company should care more than simply "if they pay we will do". He strongly advises that each piece of work done should be valuable to customers and society. What surprised me was his claim that ThoughtWorks had rejected many profitable and technically interesting contracts because of negative third pillar impact. Well, again - that's something that didn't occur too frequently in my practice ;)

Personally, I'm fascinated. In Martin's words TW sounds like a perfect mix of two differnt company types: start-up (technically savvy, interesting top-notch projects, caring about sth more than money) and corporation (financially stable, believing in good processes). I encourage everybody to read full Martin's post and establish own opinion.

piątek, 15 lipca 2011

Stay SOLID!

From time to time, in a break between fierce battles with code, requirements and time each of us starts asking questions more sophisticated than "how to write another freakin' routine". One of the most frequently repeated is how to check if a OO code is really well designed (and later implemented).
Let's forget for now about the "big" architecture and concentrate on the "small" one - single components/packages. Some advices and concepts (as DRY or GRASP) can be found here and there - for example in excellent book "Effective Java" by Josh Bloch. Additionally, tons of useful yet short articles are published by recognized authors as Martin Fowler or Robert "Uncle Bob" Martin.
The latter one created short, concise list of Object Oriented Design principles under the clever name - SOLID. In short, those are as follows:
  • S(RP) - Single responsibility principle - "an object should have only a single reason to change".
  • O(CP) - Open/closed principle - “ability to extend class behaviour without modifying it”.
  • L(SP) - Liskov substitution principle - "subtypes must be substitutable for their base classes, without modifying program's correctness".
  • I(SP) - Interface segregation principle - "create fine grained interfaces for specific purposes".
  • D(IP) - Dependency inversion principle - "depend on abstractions, not on concretions"
SOLID is few years old, but still managed to gain some attention, so web is filled with articles discussing all principles in details. One particularly interesting resource is old Uncle Bob blog post here. Also, Lost Techies has an article filled with Java examples.

Looking from experience's point of view, after some years of code crunching SOLID principles come intuitively. SRP, OCP are basic concepts understood quite early. DIP is adopted swiftly after meeting DI containers. LSP looks a bit more complex, but is in fact substantial when dealing with complex models with inheritance.
All in all, it's good to keep SOLID as a reference. Reviews can only benefit from using such simple yet useful checklist :-)

czwartek, 23 czerwca 2011

Spice up your Java with Lombok

Verbosity of Java language has been discussed for years. Almost since inception developers keen on clean and concise code were complaining about writing resource management code (lengthy if-try-catch with JDBC) or creating getters/mutators in Java beans. Simply put, Java language forces devs to write lots of boilerplate code. Some most painful spots are being addressed by language enhancements, like Automatic Resource Management (ARM) in Java 7. Yet this process is complex, cumbersome and takes time.
Is there any better (faster) relieve then? It seems there is! Presenting Project Lombok. Nice utility to speed-up development using source-code annotations. Some most useful features are as follows:
  • @Getter/@Setter - simply annotate any field to have appropriate method generated. What's more, getter can be "lazy" without any explicit locking code.
  • @Cleanup - ARM is here, no need to wait for version 7 release.
  • @NoArgsConstructor, @RequiredArgsConstructor, @AllArgsConstructor - used along with @NotNull instruct Lombok to generate appropriate constructors with arguments checking. Beautiful :)
Full list can be found here.

To entice you more, just take a look at following example:
@RequiredArgsConstructor(staticName = "of")
@AllArgsConstructor
public class Bean {

    @NotNull @Getter private String name;
    @Getter @Setter private String value;
    @Getter @Setter private int count; 
}
Isn't that appealing? ;-)

niedziela, 19 czerwca 2011

Shrink your JAR

Releasing your small project / library into public? Think about shrinking it beforehand - it's always nice to save some bandwidth if possible. There is nice (free!) tool for this purpose - ProGuard. Results, as published on the web, are quite encouraging. For example Apache Ant went down to 242K from 2.4M and that's staggering 90%.
What's more, ProGuard can do more that mere shrinking. Dead code listing (optimization) and obfuscation all come bundled.
To sum up, one quick run of this handy tool can make your release smaller and less prone to reverse-engineering. Give it a try!

poniedziałek, 3 stycznia 2011

Why is "your Agile" failing?

Have you ever wondered why is this famous "Agile" failing in your company? Why, after spending some time and money on various consultants it doesn't give expected performance/quality/customer satisfaction boost?
If so, check out this talk by Dan North from ThoughtWorks: http://vimeo.com/10380489. It may shed some light ;-)