Sunday, March 23, 2008

Code semantics

As I started a new job I was introduced to a new codebase. This happens to any developer who is starting a new job or a new role.

Since people are different, their approaches towards code is different as well, and were one developer gives his data-access interfaces and objects the suffix 'DAO', another developer will suffix it with 'Repository', hence, we might get 'ICoustomerDAO' or 'ICustomerRepository'.

The meaning is the same - a service that is charge of storing and retrieving information about a customer.

As I mentioned at the beginning, I was recently introduced to a new codebase that has its own semantics. Some of these semantics were trivial like using the convention of 'Sink'. I immediately understood that a sink is a recipient of data and it is the end of the road for this data. Examples are ConsoleSink which writes to the console and DBSink which writes to the database.

This however, is a simple example as a system is more complex than that. There are other "hidden" semantics that are just the result of differences between people and the way they things.

The example I used with the DAO/Repository in taken from the semantics of Domain-Driven Development (DDD) which gives very high importance to the way things are expressed. The base for DDD is first of all defining an ubiquitous language that is used to define the entities in the system and the relations between them.

I believe that if a software project will have a defined semantics, the amount of the mess that is usually a part of a codebase will dramatically be reduced, it will be easier to get familiar with the code and maintenance will be easier.

Saturday, March 22, 2008

Blog returned here

However, there are posts that do not exist here but u can find on: http://jajahdevblog.com/reshef