Posts Tagged ‘architecture’

Software architecting lacks good notation

September 25th, 2007

I found a blog entry at http://www.matshelander.com/wordpress/?p=74 which although lengthy and wordy hits the spot.  There is no good notation system for software architecting.

My words: Comparing software architecting to building houses is ridiculous.  Just because they share the same name (architecting) doesn’t mean they have a lot in common.  Compare a sea horse and a horse and you get the same useless result.

The romans would never be good at mathematics since they lacked a good notation.
What software architecting needs is a good notation.  UML is one way but it is not very good for evolving solutions and finding bugs.  Code is the best notation I know of but it is too close to the very program and not good at describing architecture.

Besides, after several thousand years of building houses we still miss the estimated cost.

Why is a primary key an int?

September 21st, 2007

We are used to having PKs in databases as integers.
The reason for this is that computers are good at numbers and an integer is a very versatile and fast number representation.

But there are drawbacks in the business layer.  A customerID can be compared to a orderID like so:

if( customerID == orderID ){…

This is not a good thing.

CustomerIDs should only be comparable to other CustomerIDs.
They should also not be addable, subtractable, multiplyable and being greater than anything else.  A CustomerID is equal or not equal to another CustomerID.  All other comparisions are not of this world.

I have yet to figure out how to implement this.

A comment of what to use as a primary key is found here.

What to choose for primary key in a relational database

June 17th, 2007

Anything simple.
Anything simple but not something the user knows about.

A 32 bit integer, a GUID, a string. But not the CustomerNumber or PostalCode or EmailAddress. No matter what the user/customer/client says – those things are not unique. I have been harrassing customers whether the CustomerNumber is unique or not. It has been unique for two weeks until someone remembered about foreign offices with their own numbering system or that they sometimes are changed.

Alas – do not use anything you find in the business logic as primary key.

A more technical comment on why we use int is found here.

Programming is Designing is Architecting is Designing is Programming

June 1st, 2007

I talk about the three different roles like this:
- Programming: coding, implementing algorithms.
- Designing: deciding algorithms, choosing protocols, constructing class relations.
- Architecting: making the code and machines work with the business rules.

When a programmer selects to write one piece of code instead of another he makes a (hopefully) aware choice of which code will be the best today and tomorrow. (These two aren’t necessarily the same.) By this code he influences the ways algorithms will be implemented.

When a designer selects a protocol for another he also sets some technical limits. Different protocols are more or less easy to update, debug and trace. This influences the architecture.

When the architect decides for something he has to consider why it should be done, how and by who. (whom?) Every architectural decision must be implemented (or better – does not have to be implemented) somehow and this leads to a design decision in turn.

Now, when the designer decides to use a solution it has to be implemented. It can only be implemented by the programmers. Considerations must be taken for why, done and who.

This boils down to a programmer has to know how to design. A designer must know how to architect. An architect must know how to design. And a designer must know how to program.

I would also say that a good programmer knows how to architect and an architect how to program.

Code written might have architectural implications.
Even comments have design implications.

Strong typing is considered Good

June 1st, 2007

Strong typing gets rid of lots of runtime errors. Why do script languages always use weak typing? I really don’t see anything good coming out of it.

A friend of mine, mainly a Java and Python programmer, defended Python’s/scriping’s position by telling me how fast it is. He compared the turnaround for a Java web project and a Python ditto. So I see his point, it was quite cumbersome to update the Java solution (I don’t remember the environment), but I have yet to find such a complex situation in any solution I have built for dotnet or VB6.
I doubt all Java solutions are as complex as his example.

Which sort of gets me back to the first paragraph. There is no reason for a scripting language to be weakly typed and hence more error prone.