The principles of extending software
I was quite productive today - even with some hangovers from last night :)
I done some consultant work for a customer that wanted following GoogieSpell functionality:
Now the extensions had to be made so the customer could upgrade to future version of GoogieSpell seamlessly. I chose not to put the changes inside GoogieSpell since it would make the code base too complex - therefor I had to code smart ;) Now the changes that had to be made weren't trivial - since GoogieSpell wasn't build to support dependent text boxes or additional menu items that could manipulate "everything". I thought a bit about the problem and I remembered that I have had a computer science course called Software Architecture, where I learned the 3 principles of great software design (taken from the legendary GOF book):
Now, I coded GoogieSpell in JavaScript, which lacks classes - how can I use the above principles? Good question, but basically their definition is rather abstract and I mostly use their way of thinking. The things I look at when I try to design software is:
Now, the trick is that all the design patterns are built up from the above 2 principles...! By having low coupling one can reuse and upgrade one of the code parts without affecting other parts. By having high coherence one know that this class or function does this and this and nothing else. Something I am beginning to use in JavaScript is insertion of holes inside my code where someone else can insert their code. I have done this with observers:
And extensions:
Little holes can extend GoogieSpell into this: I have released GoogieSpell 3.6 with a lot of improvements and some bug fixes. AJS 2.3 is also out and has support for events.
Code
·
Code improvement
·
Design
•
13. May 2006
|
|