The "Art of Naming"

02 Feb 2012
Posted by Hernan Wilkinson

Today we all know now that variables should not be called x or y, not even i nor n when we use the famous “for”... but do you know why? have you had trouble naming a variable? and what about a method (message) or a class?

The truth is that naming in software development is really important, so important that I usually say that programming is “the art of naming”.

But why naming is so important in software development? Because a name “synthesizes” the “meaning” of what it is being named. Names help us understand the “meaning” of the program, what the program is representing without thinking on the how.

Good names make our lives easier, on the other hand, bad names make us feel in hell. Bad names suck energy from us because we have to “re-think” every time we see that bad name what it really means, what it is the real purpose of that thing being named. At the end, bad names obligate us to do the work that other should have done, that is why we “hate” programs written by others and we “hate” them more if they are badly written, if the names are bad.

Bad names force us to “synthesize” again the “meaning” of what is being named and that is a big effort for our mind. Sometimes we find a good name and we can “rename” the bad name, but sometimes we do not have enough information, enough experience to find a good name and also sometimes (but only sometimes :-) ) our mind prefers to put energy in something else.

A good name has to provide enough information for us to understand the purpose of what it is being named. In the case of an object, its name has to make us understand its role in the context it is being named (it is not the object’s type what it is important but its name! I can remove the object's type from a program and keep understanding it, but I can not remove the object's name. If you don't believe me, see the dynamically typed languages :-) ). The name of a class (that it is also an object of course), has to help us understand the concept that that class is modeling, it has to help us grasp the behaviour of the objects that the class defines without having to see all the message the class defines. A class name “synthesizes” the meaning of all the messages its instances can understand.

Names are for humans, not for computers. A computer does not care about the name of a variable or a class, for a computer they are all symbols, but it is not the same for us. We as humans, interpret those symbols, we attach them semantic to be able to understand what we are reading. That is why a refactoring is not important for a computer but it is very important for a programmer, it is because we are providing semantic, meaning, to what we are refactoring. The extract method is one of the most paradigmatic examples of this process of providing meaning, that is why every time you have to maintain code you don’t understand, the first thing you have to do for every piece of code you end up understanding is to extract it to a method, but not to make it “nicer” but to name that piece of code! to provide meaning to that set of collaborations between objects that you are extracting, to help you understand the program the next time you read it.

And yes, naming is not easy, naming is hard. A name is a “summary” of what it is being named and no good summary can be written without understanding first what has to be summarized. Therefore, if you have problems naming something it is basically because you have not fully understood what you are trying to name.

For example, why classes are so difficult to name? because you have not completely understood what concept the class is representing. But why smart people, people that have degrees from universities, that are well versed and manage a vast vocabulary can not find a good name for a class? Basically because they don’t have “enough experience” with that “element” they are trying to mane.

Classes are the more interesting example when dealing with “class based” languages, like Java, C#, Smalltalk, Ruby, etc. In those languages we are “forced” to name a class when we did not have the chance to see, to play, to understand how its instances are going to behave. Those languages go against the natural way of learning, they enforce us to name things we don’t know and that is why we end up with class names like “ObjectManager”, “ServiceHelper”, “ObjectDirector” and so on, names that can mean anything, and that makes sense because at the time they were named they could represent anything.

So, if you feel bad with yourself because it is difficult for you to name a class, don’t be, most of the time it s the programming language fault, it is because the language is forcing you to learn in an anti-natural way. It is forcing you to name something you don’t understand, but yet, you have to name it, you have to “summarize” its meaning with a name... crazy.

That is why “prototype based” languages like Self, IO, JavaScript, that is class-less languages, are better to tackle new problems and domains that you don’t know. They are better because they don’t force you to name something you don’t understand, you just create it and use it, and then, when you have enough information, you name it. Working with Self or LivelyKernel (Dan Ingalls current project) makes you see and feel the difference.

So, are we stuck? we are doomed to badly name classes? Of course not! and now that we understand what the problem is, we can think on a solution. But before talking about the one I propose, it is important to understand that programming is not a “point in time” task, it is not something that happens in a moment but in a “lapse of time”. Why it is important to understand this? Because it will help us with the solution, it give us the opportunity to do things wrong for certain time until we can do it right.... until we can do the last step in TDD, the refactoring.

So, when you don’t know how to name a class do not use a “bad name” for it, do not name it with what gets to your mind at first glace but use a “meaningless name”, a name every time you see it, it tells you “Hey! change me!”. That is the difference between a “bad name” and a “meaningless name”. A bad name becomes a good name with the time... after reading ObjectManager many times we don’t see it anymore as a bad name, we get use to it and our mind provides it a meaning that it is not explicit but implicit in our head and we live happily ever after with that bad name.

On the other hand if a class is named “XYZ” or “ZZZ” or something like that, a symbol you can not provide any meaning, your mind will force you to change it some day, and that day will be the day you will understand what you are naming. Will that name be the best? Maybe not, but for sure it will be better that one you thought without enough experience.

Conclusion, if you don’t know how to name a class, don’t waste your time thinking three hours on that name because the only thing you will get is a headache and a bad name. If you don’t know how to name a class, give it a meaningless name until the time you can correctly name it. That moment will be after you have played sometime with its instances... Software development is a learning process, therefore incremental and iterative so don’t try to make it right at the first time, you won’t anyway... and that is why TDD is so important in software development, but that is a topic for another post :-)

Hernan.

Posted by Hernan Wilkinson

One of the recurrent problems I see when teaching OO design is the “names” used by the programmers to name classes, methods, etc.
The problems are different depending if attendees are from the industry or the university. At the industry I see that names are wrongly selected, bias technology names, while at the university it is common to see the lack of ideas to name things (which makes sense because they have less experience). I will concentrate on the problem I see at the industry.

Basically the problem can be summarized as using names towards the technology model instead of the business model. I’ll show a few examples that will clarify the idea.
1) I usually use a problem when teaching the introductory OO design class, where attendees have to model a traffic light (“semáforo” in Spanish). This problem has many interesting edges like what really is a “traffic light”, is it just the one that control the traffic on a street or in a corner (or street intersection)?, but besides that and going to the problem of this post, it is interesting to see the names that are used to call the class that will model that concept. Usually those names are “LightContainer” or “TrafficController” instead of just “TrafficLight”. Clearly “TrafficLight” is a better name because it is the name used in the problem domain and therefore using it in our model will narrows the semantic gap, but why do attendees think on those names?
2) Another example I use, in this case on the TDD course, is to model a on-line shopping store. That problem is really interesting because there are many many concepts to model that usually are ignored or not seen by most attendees, like shopping cart, the cashier or the just the sale. Shopping carts are generally discovered and modeled, but sometimes attendees use names like “ProductContainer” or similar.
The cashier is a interesting case. I guide the solution using a metaphor on real supermarkets so they can see that when it is time to pay, it is the cashier responsibility to do the sum, debit that amount on your credit card and so. But it is funny to see that even when I use the word “cashier” sometimes the class that models it as “SaleTransaction” (not realizing that the sale is the result of what the cashier does) or “CreditCardService” or “PaymentManager” and the like.
The sale is an object that usually nobody see and therefore it is not modeled. After the attendees realize that concept has to be modeled I go to the next issue, that is where to “store” the sales. Sadly, and as much as I repeat during the course to think about the problem domain, I usually get names for that object like “SalesRepository”, “SaleDAO” or the like instead of “SalesBook” (in Spanish “LibroDeVentas”, a well know accounting term).

Why does this happen? Why the right names are not selected? I realized after given these courses that the pattern is the same: the selected names are thought from a “technology” point of view, as programmers; we do not use the words of the problem domain in our programs.
I mean, I don’t know any accountant that calls the sales book as “sale repository”, neither “sale dao”, and I never saw any supermarket employee call the shopping cart as “product container” and my wife never called a traffic light as “traffic controller”.... what is the problem?
The problem is that we continue programming (modeling) focusing on the technical side and not on the problem domain side. Of course, if we go to a supermarket we will not tell our companion “please, give me that product container” but “please, give me that shopping cart”. Why?, because we are not programming there, we “are” in the problem domain “for real”.

Ok, let’s assume that that is the problem, why do I see this problem on the industry and not at the university? I think this is due to some kind of “infection” that people at the industry get from models, frameworks, finally examples that students at the university has not been exposed yet. As humans we learned (a big deal) from examples, and sadly most examples we have are really bad at giving names, sometimes because “hey! it is just an example” and sometimes because the ones that wrote the framework, model or example has became part of this vicious circle and therefore the names they use are like those we later choose, that is “nnnContanier”, “nnnRepository”, “nnnController”, etc.

How can we avoid this mistake? First of all realizing that we have to make a change in the way we think, we have to start thinking on the domain problem and not on “programming issues”. Date is called Date and not “NumberContainer”, and String is called String and not “CharacterCollection”, those are good examples of names thought from a problem domain point of view. After that, we can use a smell to see if we are choosing incorrect names. The smell is basically to see if the name has words like container, repository, service, controller, manager or any of the design pattern’s name (again, Directory is called Directory and not FileComposite or the like). But please remember, this is a smell, not a rule!, sometimes we have to use names bias technology issues, and that is basically when modeling a technological problem domain.

So from now on, if a name you think for a class has those words, if it has that smell, try to think of a better one and if you can not come up with a good one (that for sure will happen) then choose a meaningless name but please, not a bad name. I will explain the difference between them in another post, this one has became larger that I expected :-)

Hernan.

Posted by Nicolas PS

Introducción

El protocolo FIX (Financial Information Exchange Protocol) es un protocolo de mensajes para el comercio de instrumentos financieros. FIX se utiliza ampliamente para la comunicación automática entre los participantes del intercambio de instrumentos, y especifica como son los mensajes para crear ordenes de compra y venta y consultar cotizaciones de instrumento, entre otros. Este protocolo es el que hay que utilizar para comunicarnos con practicamente todos los mercados financieros de manera electrónica.

En este articulo, veremos los aspectos básicos del protocolo FIX, como utilizarlo mediante la librería de java QuickFIX/J mediante un ejemplo como cliente y servidor, y algunos aspectos poco obvios que hay que tener en cuenta al utilizarlo.

Continue reading...
Tags:  | Add a Comment
Posted by Emilio Gutter

Deploying Ruby On Rails in a Windows environment can be very painful. I couldn't find any blog which really helped me, so I decided to summarize all the necessary steps I followed to successfully deploy a Rails application in a Windows 2008 server from scratch. I won't give much explanation on each step, so if you like to know more about it, at the end of this post you'll find a list of articles I found useful.

The environment:

  • Windows 2008 SP2 x64
  • SQL Server 2005
  • IIS 7.0
  • Ruby 1.8.7
  • Ruby on Rails 2.3.5
  • Mongrel 1.1.5

Steps:

  1. Install Ruby VM
  2. Install Rails
    gem install rails -v '= 2.3.5' --include-dependencies
  3. Install any other dependencies your application requires
  4. Install Sql Server adapter
    gem install activerecord-sqlserver-adapter --version 2.3.5
  5. Install ruby-odbc
    1. Download ruby-odbc
    2. Copy the zip's content to ${RUBY_INSTALLATION_DIR}\lib\ruby\site_ruby\1.8\i386-msvcrt
  6. Open the ODBC Data Source Administrator with the command
    C:\Windows>SysWOW64\odbcad32.exe
    (make sure you use this command instead of using the regular access from the control panel)
  7. Create a System DSN using your specific database connection properties
  8. Open the command prompt and go to the Rails application root folder
  9. Create and initialize your database
    • rake db:create RAILS_ENV=production
    • rake db:migrate RAILS_ENV=production
    • rake db:seed RAILS_ENV=production
  10. Install IIS Application Request Routing and URL Rewrite extensions
  11. Edit the hosts file located at C:\Windows\System32\drivers\etc\hosts and add the following line
    127.0.0.1 localhost localhost-1 localhost-2
    (add as many localhost-x hostnames as mongrel services you're planning to setup)
  12. Open IIS Manager and create a new farm. Add one server for each of the mongrel services you're planning to setup
    For each server use a different address (i.e. localhost-1, localhost-2, etc.) and a different port number (i.e. 3000, 3001, etc.)
  13. Edit URL Rewrite rules and add the following rules
    1. Rule 1
      • Pattern: ^$
      • Action: Route to Server Farm
      • Path: /main/index
      • Check stop processing subsequent rules
    2. Rule 2
      • Pattern:^([^.]+)$
      • Action: Route to Server Farm
      • Path: /{R:1}
      • Do not check stop processing subsequent rules
  14. In the IIS Manager create a new Web Site and in the Path box, type or browse to the directory that contains your Rails public folder.
  15. Download this win32 services gem and install it.
  16. Download this mongrel-service gem and install it.
  17. Setup as many mongrel services as you need
    mongrel_rails service::install -N my-app-node-1 -e production -p 3000
    mongrel_rails service::install -N my-app-node-2 -e production -p 3001
    etc..
  18. Launch the Window Services console from Control Panel. Change the startup type of your mongrel services to Automatic and start each of them.
  19. Open a browser and test your application

Finally, some articles you might find useful:

Posted by Emilio Gutter

El código se encuentra disponible aquí



ESUG 2010: OOSCM Talk

04 Oct 2010
Posted by Hernan Wilkinson

Agile is Clean Code

22 Jun 2010
Posted by Federico Zuppa

But ... Isn't this a requirement for all approaches? Why do I have the impression that in Agile, the technical aspect is more important? When I was at University, I remember vividly having heard (and unfortunately later repeated) that the programmer had one of the less important tasks in the chain of producing software. The most important, more senior and smarter people are the architects/designers that analyse and design the application, giving the programmers some diagrams that they 'just' have to translate into code. That seemed like an easy task!!

What means Clean Code?

Ron Jeffries says that we should write "clean code that works". Uncle Bob then made an entire book of Clean Code. What is clean code? Following uncle Bob's explanation, at the high level, it is code that is well structured and which follows SOLID design principles. At a lower level, it's code that has meaningful names, good and useful comments, elegant functions and formatted code. It's code that expresses the intent of the developer in a clear way. It's code that contains no duplication. And is code that is easy to understand.
And how do you know it works? You don't know because you code it and you are a great programmer :-). You know it because there are automated tests that certify it. Agile development relies on test automation to know that features work and to know thay they do all the time. Beck says "Software features that can't be demonstrated by automated tests simply don't exist". Test automation is one of the pillars of clean code because it allows to continually refactor, it allows to redesign and ultimately it allows to deliver a continuous flow of value.

Why is so important in Agile?

These are a few reasons to justify the 'pain' of writing better code:

  1. Cost of Change is lowered: Agile welcomes change, even late in the development process. However, to be able to change, it should be cheap to change. Code that is well designed, easy to read and thoroughfully tested is easy to change and can be changed without fear of introducing new bugs. On the contrary, code that is hard to understand, is not well modularized and has no automated tests is difficult to change and the risks of introducing bugs while modifying it are many.

  2. Iterative & Incremental Development means more time coding: In sequential development, there are big phases of analysis and design before the coding phase starts. When the code phase starts, most of the design decisions should have been taken, so development proceeds fast. In Agile, development starts earlier so this phase takes more time. As the code base needs to be manipulated for a longer time, it pays to have it clean. Reading Clean Code, one of the a-ha moments that I had was in the chapter where Martin explains that in the life of a system, the majority of the time is spent reading code, not writing it. I started thinking about my experience, and that was entirely true. I have worked in many systems that already have a lot of features in it. In those systems, each time that I needed to add a new feature, I spent most of my time finding where to put the feature and how to accomodate it to the existing features than actually coding it.

  3. Iterative & Incremental Development means the code is changed frequently: Design is performed incrementally in Agile. Every iteration, new features are included in the code base. The design of the system should be one that cares about all features included until that moment. Therefore, this means that a lot of times the existing design needs to be modified. If the code is not maintained clean, understanding and modifying it may become difficult in a short period of time.

  4. Working software is more important than Comprehensive Documentation: This is what the Agile Manifesto says. But having the code base in good state, with good comments, good names, well modularized and with a comprehensive set of automated tests is the best documentation that a developer may have. Been able to understand a piece of code easily because it's simple and it expresses its purpose with clarity is much better than going through UML design documents. Being able to run and debug a set of unit tests for certain functionality provides the best tool to understand that functionality. After all, what really happens is what is in the code, not what is in the documentation. Code is always up to date while documentation is hard to maintain.

Why don't we do it then?

Lack of skill? Sometimes... This is a craft. A difficult one and we need to spend a lot of time getting better on it. Commitments.. Yes. Our own commitments and the commitments of our managers. Being under pressure and with the deadlines on sight, make it 'work' takes another meaning (I mean, you just want to throw some code that at least compiles and shows something on the screen). I won't follow. There are always plenty of reasons to do things worse!!

Humm.... but Scrum doesn't include a topic on technical practices

I've seen great debates last year over the lack of technical practices in Scrum. Some people believe it is a shortcoming of Scrum while others say Scrum is a product development framework and therefore it is out of scope to include a technical section. Without entering into this debate, something that I've seen a number of times is software development teams starting 'just' with Scrum, leaving the introduction of some XP practices like TDD for the future (if you take a look the popularity of XP and Scrum, I guess many people observed the same!). This may be justified by an approach where changes are introduced gradually (after all, Scrum per se represents a major change at the organizational and process level).
But what happens if you start with 'just' Scrum?. Basically, I believe Scrum alone is not sustainable. At least, in software development it is not. As iterations go by and the code base grows, there is more and more work to finish each feature. By consequence, teams cannot keep their commitments, the business people get mad and you hit the Scrum Wall (ouch, hit it many times)
This is still a topic I think about often. Scrum, per se, is not sustainable in software development. However, it is the most succesful process in the Agile world. It seems that leaving technical aspects out of it is both something that has help Scrum become more popular and the reason of many of its failures in the development world.

Conclusion

Clean Code is one of the pillars of Agile. Being able to deliver clean code that works greatly enhances the chances of deliver value sustainably and it makes our life as programmers better. Clean code provides the best ROI and the best documentation. Of course it is difficult to do it and it certainly takes a lot more time than writing crappy code. However, by not doing it, we lose a lot of the advantages that Agile claims.

Posted by Jorge Silva

Nowadays, more applications are RIA oriented solutions. RIA (Rich Internet Applications) is a new kind of application with more advantages than traditional applications. It emerges as a combination of features offered by web applications and desktop applications. Even multimedia capabilities are covered because these environments have internal players.

RIA is a new concept that is growing with the advent of Adobe’s product Flex, Flash, OpenLaszlo and the Ajax platform.

The goal of this presentation is to show by example the way to integrate a pure Smalltalk back-end with a flexible front-end made it with Flex, using web services. In this way we:

  • Obtain Smalltalk capabilities to model my business domain

  • Give my application a rich and appealing interface in short time, with many problems already solved.

With this integration we look for best domain modeling techniques with Smalltalk, as reflective capabilities, dynamic typing and, in the other hand, to get the best communicative interface as RIA.

Finally, integrating in this manner is a perfect complement when developing applications not only web but desktop too, because you give the final product a unique dynamism thank to Smalltalk and a rich, friendly and interactive interface as Flex (o more generally RIA).

This presentation was presented at ESUG 2009. You can see the handouts here:

View more presentations from 10Pines.

Mutation testing

18 Sep 2009
Posted by Hernan Wilkinson

During the 70s, mutation testing emerged as a technique to assess the fault-finding effectiveness of a test suite. It works mutating objects behavior and looking for tests to “kill” those mutants. The surviving mutants are the starting point to write better tests. Thus, this technique is an interesting alternative to code coverage regarding test quality.

However, so far it is a “brute force” technique that takes too long to provide useful results. This characteristic has forbidden its widespread and practical use regardless new techniques, such as schema-based mutation and selective mutation. Additionally, there are no mutation testing tools (to our knowledge) that work on a meta-circular and dynamic environments, such as Smalltalk, so the compile and link time are the current technique's bottleneck.

This presentation will introduce the notion of mutation testing, analyzing its advantages and disadvantages with a Smalltalk-based tool. The tool uses the Smalltalk's dynamic and meta-programming facilities to notably reduce the time to get valuable output and help to understand and implement new tests due to its integration with the rest of the environment.

This presentation was presented at ESUG 2009. You can see the handouts here:

View more presentations from 10Pines.
Posted by Emilio Gutter

Incremental deployment: minimize time-to-market
Since agile processes deliver working software at the end of each iteration (typically around 1-4 weeks) and requirements are prioritized by business value, the organization might choose to release a version of the product as soon as a Minimum Marketable Feature (MMF) has been completed. This way the organization may start to perceive real benefits from the new product far before the development is completed.

Adapt to change
Agile processes are designed to accept and respond to business changes, such as actions done by competing organizations. By means of the dramatic reduction in the feedback cycle length, it possible to incorporate internal customers (i.e. product management; marketing and sales; etc.) and end users feedback into the development plan rapidly and without significant change in cost. Having an agile software development process in place usually represents a strong competitive advantage with respect to other companies using more traditional development methods.

Building quality in
The key of an incremental deployment strategy is to build an automated regression test harness and the discipline to follow best engineering practices such as: continuous integration; test driven development; code refactoring; coding standards; evolutionary design among others. Through the use of these practices the team is able to produce better code, easier to maintain and with less defects. On the other side, permanent collaboration with business representatives helps the team to deliver software that is aligned to the business needs.

Eliminate waste
Agile is a lightweight development process based in a just in time strategy. By eliminating extra processes and extra inventory, the product is developed faster and the cost of adapt to change is minimized. Through a continuous improvement process, the team is encourage to constantly evaluate and adapt the process and the product in order to maximize the value delivered to the customer.

Posted by Hernan Wilkinson

When talking about Smalltalk, there is definitively an over use on the possibility to add messages to Object class. It is so easy to do it, that people usually do it just to get something working fast, even if the coding is poor. There are a lot of messages (mainly #isXXX messages) that do not belong to Object and represent a bad design decision. Most of them are implemented there because they are "handy" and easily "reused". For example #-> or #assert: implemented in Squeak. Definitively not all objects should respond to them. Many of these messages are only used from "inside" the object, like the #assert: message.I would never write something like this: 1 assert: xxxx. Instead I would write: self assert: xxx witch clearly shows that #assert: is not a message that should be respond by every object, but only for those that represent assertions.

From my point of view, this issue is not an inheritance's problem per se, it is a miss-used of inheritance. If I try to use a hammer as a screwdriver, it is not the hammer's fault, but mine.
How is inheritance related with reuse? Well, that is an important question. Inheritance from the "pure theory" point of view, should not be use as a means of reuse. Reuse comes from good models, not from inheritance. Inheritance should be used as a tool to organize the knowledge that as a programmer, you are acquiring from the business domain. Classes should be use to represent the concepts and ideas you see in the business domain and inheritance should be used to organize how this concepts are related in an ontological way. So for example, an abstract class should represent an abstract concept wich defines the essential behavior that all the objects instances of its concrete subclasses should respond. Due to this relationship reuse comes aside, but reuse is not the means of inheritance. Subclassing just to reuse the implementation of a superclass is not a good design decision; it will bring problems sooner or later.

There has been an attempt to minimize the methods implemented in the Object class. For example on the Squeak distribution the class ProtoObject has been created. ProtoObject has only 35 methods whereas Object has 436! (on the basic image of Squeak version 3.10.x). Although ProtoObject has fewer methods, I do not agree with some of them. For example #ifNil: (and the like) and #tryNamedPrimitive: (and the like). Clearly these two messages (and their mutations) are implemented in ProtoObject as a means of reuse and not because every object should understand them. For example, why an account should respond #tryNamedPrimitive:? What does it mean to an account? A better design should have an object that represents the VM (for example) to which I can send the message #tryNamedPrimitive:. Of course the problem with this is how to access to this object and that is why that message is implemented in ProtoObject, because every object will inherit that method! And it will be so easy to use it as to write self tryNamedPrimitive: xxx. But thinking a little bit we can see that it is very easy to solve this problem. For example declaring this VM object in a global scope, so any object could send the message #tryNamedPrimitive: (and therefore reuse it), but not understand it. This brings me to the "rule" that says composition is a better tool to reuse.
The problem of using inheritance to reuse is that inheritance generates a strong coupling between the classes, its subclasses and its instances, where composition does not.

Inheritance generates an implementation and structural coupling between the classes and its subclasses (affecting directly their instances) where composition only couples an object with the composed one through the messages the former sends to the later. No implementation coupling, no structural coupling, just coupled by the message names one object send to the other, therefore a better design (the lower the coupling the better). This is the reason why good frameworks, black-box frameworks use composition over inheritance, where white-box frameworks being more immature, use inheritance to configure them.
This brings me to the idea of how hard should we stick to this, should we never "break" this rule? Well, I would not called it a rule but an heuristic, therefore it should be follow as much as possible, but we should also be pragmatic too. Sometimes subclassing to reuse while we are still learning about the problem is ok, is like making a white-box framework at the beginning. But we should never forget that our goal is a "black-box framework".
Other languages like Java do not suffer this problem and good designs can be implemented with it (although not so easily :-)). Java does not have this problem because Object class cannot be modified. This clearly shows that having too many methods in Object is not a problem of inheritance, but on how use it.

To summarize:

  • Inheritance should not be used to reuse, therefore having a lot of methods in Object class just because it is "handy" is a clear example of inheritance being used incorrectly. It generates unnecessary coupling which will make the system harder to change or refactor later.
  • Inheritance is just a tool; you can use it right or wrong.
  • There are other tools like composition and design techniques which solve the same problems and generate less coupling.
  • Reuse comes from good models, not from inheritance.
Posted by Emilio Gutter

One of the first steps a new agile team has to undertake is to choose their iteration length. My general advice is to start with 2 weeks iterations, although I let teams choose the length they feel comfortable with. I believe it is better if the team make their own decisions and learn with the experience. I'm gladly surprised when a team chooses a short iteration length, but sadly that doesn't happen very frequently. Usually the main argument I've heard in favor of longer iterations is that shorter iterations are stressful and there is not enough time to finish all the work.

Opposed to this general belief, my own experience taught me that longer iterations are generally more stressful than shorter ones. I believe the main reason behind such experience is related with the complexity in providing accurate estimations. I don't believe there is such thing as a perfect estimation and I'm convinced that high level estimates such as story points are more helpful to forecast than detail estimates such as ideal hours. It is very hard to convince people who come from traditional management about this idea, but as I said before, experience is the best teacher.

Let me give you some examples. Team A works with 4 weeks iterations. The first week they have a promising start and their burndown curve is aligned with the ideal trend or maybe even a bit under it. By the end of the first week the burndown curve starts moving up until it reach the ideal trend. By the second week, it is over the ideal trend and the gap keeps expanding. Inevitably questions comes from everywhere. Why are we getting delay? The Product Owner starts getting anxious and he transmit his anxiety to the rest of the team. The next 3 weeks, the team will struggle to improve their burndown curve. Finally at the last week they decide they won't be able to finish with everything, so they just remove some scope from the iteration and try to do their best to finish with the ongoing work. With a bit of luck, they were disciplined and they started working with the most valuable stories, so they cut off from the iteration the less important stuff. At the end of the iteration the result is clear. They've just passed a very stressing month and they are probably blaming the new methodology which was put in place. Worst thing is probably next iteration won't change much. They have work delayed from last iteration and more pressure to deliver new stuff. Besides there are a lot of hours to fill for a whole month. It is very hard to identify and estimate all the tasks required to complete several stories, specially when they are big enough to fit in a one month iteration. Without much doubts, next iteration the same scenario will repeat: "old habits die hard"

Now let's think in a team which is working with 2 weeks iterations. Team B also starts really well and in the first week the burndown curve is a bit under the ideal trend. The second week the burndown curve have already reached the ideal trend. Although, as the team has planned small stories which can fit in a 2 week iteration and there aren't a lot of hours to fill in only two weeks, the gap between the burndown curve and the ideal trend is insignificant. Besides the second week is also the last week of the iteration. At this point there is not much value in looking at the burndown chart. The team has only one week to finish all the remaining work, therefore it is quite easy to recognize if everything can be finished or not. Working with 2 weeks iteration provides the team higher visibility, reducing the probability of having to adjust the iteration scope. If there was a big mistake in the estimations it will probably be caught very soon and the team will be able to adapt the iteration's plan without having to struggle for another 2 or 3 weeks. Also the team has discovered an important lesson. If they work with 1 or 2 weeks iterations, the burndown chart is not really valuable. By the time you can see some trend in the chart, the end is so close there is no need of the burndown to know how things are going to end up. Little by little they will also discover estimating tasks in ideal hours is not really necessary. High level story points give them all the information they need.

There are many other reasons to work with 1 or 2 weeks iterations. First all the meetings such as planning, reviews, retrospectives, are much more shorter and less exhausting. With shorter iterations there are more frequents chances to re-plan and adapt to change. This is very important, specially for teams who are starting with Agile and need to learn and try new things fast. Finally some good practices turn to be mandatory. For example it is not possible to deliver working software every 2-weeks without a reasonable automated test harness. I found out frequently when teams reject short iterations, they are just hiding other problems (e.g. communication problems between team members; lack of an automated test harness; Product Owner doesn't participate enough; too big user stories; etc.)

Shorter iterations are not stressful; it is just another Agile Myth!

Posted by Emilio Gutter

Distributed Agile - Software for the new world order! is the name of the presentation Matt Gelbwaks and I gave last year at Agiles 2008.

In this presentation we demonstrate through The Maths of Agile why not only small collocated teams can be Agile and we review our experience coaching distributed teams around South America, USA and Europe.

Download the presentation here or watch the videos!

Part 1 of 5

Part 2 of 5

Part 3 of 5

Part 4 of 5

Part 5 of 5