Showing posts with label architecture. Show all posts
Showing posts with label architecture. Show all posts

2009-03-20

Time estimation and business objects, CRUDSLM

A small rule I have while estimating time or looking into a system is to run CRUDSLM against all business objects and possibly all database tables.

I make sure that every business object has one tick in each C, R, U and D.  This is the normal case and by doing this I guard myself against forgetting something.  There are times when things aren't updated and even not deleted but then I know this and can argue for it.
It is a fast exercise and I usually run it only once against every business object and once against every database table.

For time estimation I extend the CRUD with SLM where the letters are Search, List and Manipulate respectively.  Many times, especially with the main business objects, they are Listed and Searched.  Then for reports, imports and exports they have to be Manipulated too.

I have many times found out that Delete is missing.

2008-11-02

Exception and how to classify

One way to classify the custom exceptions thrown by an application is by how fatal they are.  An Eric Lippert has a good idea which somewhat rhymes with my own thoughts of 3 levels of importance.

2008-05-13

Unit testing - can be too much

I like unit tests, I really do. But I have also come to realize that many tests don't have to be done.

One can for instance code according to Fail At Once to make the compiler do the tests.
Or one can autogenerate code and hence only have to unit test a fraction of the resulting code.
Or one can du integration tests and take for granted that if the integration works the unit tests work too.

I have tried all three and believe in laziness - to get more done while working less. So I say that a thought out mix of all three above supposedly is the right way.

Patrik Löwendahl thinks approximately the same.

2008-01-22

The simplest possible solution, but not simpler than that

This message will be repeated in english.

När man inom Agile pratar om den enklaste metoden menar man inte den lösning man först kommer på eller den som går snabbast att implementera.
Med enklast innebär den lösning som löser uppgiften med minst extra information och avsteg från befintligt mönster.

Detta kan tarva en förklaring.
Med minst extra information menas möten, dokumentation och implicit och explicit kunnande. Om lösningen följer gängse mönster behövs antagligen ingen dokumentation, varken som explicita dokument eller inline-kommentarer. Om lösningen är "rätt" krävs mindre möten, diskussioner, dokumentation, rådfrågningar och redogörelser.

Enklast är inte nödvändigtvis den lösning som kräver minst tankearbete eller minst jobb.

För att vara ärlig talar jag inte för hela den agila rörelsen. Texten ovan är min tolkning av begreppen, metoden, livet, universum och allting.


When the agile development movement talks about the simplest solution; they do not mean the first solution that pops up in the head or is fastest to implement.
Simplest means the solution that solves the problem with least extra information and sidesteps from the chosen/optimal path.

This might demand an explanation.
With least extra information means meetings, documenation, implicit and explicit knowledge. If the solution follows the chosen path, colour and rythm of other well written parts of the solution; it probably doesn't need documentation, neither as explicit documents nor as inline comments. The "right" solution requires less meetings, discussions, documentations, questions and answers.

The simplest solution it not neccessarily the solution that requires the least amount of thoughts or work.

To be honest I cannot say I speak for the whole agile movement. The text above is my view of the terms, the method, life, universe and everything.

2008-01-04

Central objects in the domain model

This message will be repeated in english.

Bli inte förvånad att det centrala på en fabrik inte är det centrala när domänen modelleras.
I kvalitetssäkringen av en rörfabrik är inte nödvändigtvis rören som är centrala utan istället alla mätvärden; och inte ens dem utan den lilla biten som säger om mätningen är godkänd eller inte.


Do not get surprised when the central object in a factory is not the central object in the domain model.
When creating a system for quality assurance in a tube factory it is not neccessarily the tubes that are central in the domain model but the measurements; and not even them but the small bit that tells if the measrumenent is approved or not.

2007-10-19

Fail At Once

This message will be repeated in english.

Automatiska tester i all ära men hade det inte varit bättre om man inte hade behövt testa alls?

Jag kommer komma tillbaka i ämnet.


Automatic tests are great but hadn't it been better if one didn't have to test at all?

I will get back on the subject.

2007-10-17

The right solution is often the right

This message will be repeated in english.

Den "rätta" lösningen, d.v.s. den som en habil programmerare helst vill göra, är ofta den riktiga. D.v.s. den som är snabbast, billigast och/eller bäst.

Jag har inga siffror eller ens halvobjektiva mätningar eller exempel utan bara en känsla efter att ha drömt mig tillbaka i projekt. Felaktigt användande av "Rätt" lösning skapar måttlig extra kostnad medan felaktig lösning kan bli hur dyrt som helst.
Förutom att bli billigare, rent kontomässigt, gör det programmeraren gladare med. Han får möjlighet att skriva trevligare kod och kanske t.o.m. testa en teori. Detta ger bättre kod.


The "right" solution, the one the programmer prefers, is often the correct one. The one that is cheapest, fastest and/or best.

I don't have any numbers or even halv objective statistics to support my case but only a feeling after having thought back att earlier projects. Implementing too many "right" solutions adds marginally to the cost while using the wrong solution has no upper limit.
Besides being cheaper in the long run the programmer is also happier with being able to create nicer code and even test a new theory. This gives better code.

2007-09-25

Software architecting lacks good notation

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.

2007-07-17

What priority levels to choose

When choosing how to number priorities I usually use 3 levels:
1) Critical. These are show stoppers. Without these fixed, the whole system is a waste of money.
2) Workaround exists. The customer have to call you (the developer), they might have to buy new hardware or send a backup copy by airmail deluxe. But a workaround still exists.
3) Cosmetic. This is anything that the users can figure out the solution for by themselves.

These 3 levels are not enough so they have 3 priorities in turn. 1, 2 and 3.

All in all 9 levels.

It is so simple it seems to work.

2007-06-18

Even n-n relation tables should have a simple PK

Continuing with the above/earlier I say that even the table to create a many-to-many relationship should have a simple primary key.
E.g.:
Table User_Role
- field UserRoleID PK
- field UserID FK
- field RoleID FK

As long as harddisk space is cheap and a simple PK does not create a performance impact there should be no reason to not have a simple primary key.

2007-06-17

Top down or bottom up

The discussion whether to design software bottom up och top down died with intellisense/typeahead/whateveryoucallit; it was so much easier building bottom up. Then refactoring tools entered and suddenly made it easy to program top down again.
Personally I believe the two methods should be mixed. Not like "these methods or modules we design top down and these bottom up" but more like "these methods we design no matter the way".

Like this:
Here is a method I'd like to have. Here is the call. There is the method signature automagically created. Then some implementing code. And further calls to yet non-existing methods. Which are automagically created. Until we get all the way to the bottom. Where we adjust a couple of parameters. And refactor this up again. And adjust. And refactor. Until we are back where we started with code that is readable both if you track it from the top or the bottom.
Or the other way around if you prefer.

As long as the code gets readable. And updatable.

What to choose for primary key in a relational database

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.

The simplest solution is often the best

I have a rule (not a rule really, simpler than that) that if I can't explain a thing or defend a standpoint in a minute or two I am probably not correct.
I am necessarily not wrong but I am not correct either.

Some issues take more than 2 minutes to clearify but then the problem lies elsewhere, in a bigger scope.

2007-06-01

Programming is Designing is Architecting is Designing is Programming

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

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.