Is performance a factor to be considered while designing ?
This weekend, I was out with two of my friends with whom I met after long.
All of us are IT professionals so obviously it was not long when we started debating on this interesting topic (at an Indian restaurant).
In that cold dead night, the kind of tiny hotel was overwhelmed with the noice of our arguments.
Though the debate ended without any conclusion like all such debates do (it did consume couple of hours), I could not help letting it go off my head.
So here I pitch it to large audience in an attempt to seek an answer.
I think performance should not be considered while designing a system, i have been into such discussions before.
I am sure most of you ( sure not all of you) would be surprised.
So here goes explanation for what i just said and some effort that i put validating my stand.
let me start with what I think performance means.
Performance as per dictionary is the manner in
which or the efficiency with which something reacts or fulfills its intended purpose.
who gives a darn, in programming or rather SDLC it means efficiency with which something fulfills its intended functionality.
A lot of people normally missunderstand performance for just spead which is incorrect.
The second thing i would want to describe is the Design phase and its role in SDLC.
I believe When one sits to design, one should be sure of what the user wants. s/he also should ensure of what user needs is actually something that deserves to be done in the first place.
But one would argue - most of the applications in our age definately come with performance requirements right from the user.
for instance its very acceptable for a user to tell you right on the first day that he would want his application to process some "X" number of txn's in a sec.
So should this not mean we should consider this requirement while designing ?
Well you definately should but there is a catch, for something to be perfromant it should first work!
To put it in a simple manner I would first strive to design something that meets the goal (processing txn) and then care about effectively doing it.
This is just like- if I were to write a crucial mail, i would first compose the mail that covers all the points that i want to communicate accross and then care about how efficiently i wanna say that (ofcourse like most of us do spellcheck just before they do CTRL+ENTER in outlook).
To ellaborate this further when i sit to design, my goal would be to write a system that meets what it is originally supposed to do along with the implicitly understood requirements like extensibility, scalability.
by scalability what i mean here is when user says x txn's i shld write a system with clear interface and modular enough to support it.
However, clearly Design as i see should focus on things like scope, input points and input, output points and the correct expected output.
I dont deny requirement of the performance should be sitting somewhere back and should only influence how good you design the system to respond to the changes that come up in future.
You may just mention it to the implementers for them to be able to meet it.
Here is a small article with Martin Fowler ( he is the one who favours agile methodologies like refactoring, TDD and extreme programming).
http://www.artima.com/intv
I believe performance is more of implementation and Design is more of architecture and interfaces.
One thing i believe clarifies my point is that none of the OOAD design diagrams (neither the SSAD ones) have any way of depicting performance!
Even the most detailed ones i.e. the statechart which describes something as elementary as methods in an object, has no provision to talk anything about performance.
According to me at design you can leave it as generic as "Function Z does A (using B) and returns C, it would intake D and E" where B should be described the least, you should leave it for implementers to decide what they want to use.
The last thing i would want to add here is some of the systems like lets say algorithms are somewhat an exception to my prose above, most of the times we know what an algorithm does and they are just re-written for performance.
Even otherwise sometimes when they are written for the firsttime it has performance at its core and the core functionality is as generic and well understood as just to hold something or sort something.
More to this an interesting post on Sun website by Brian Goetz who actually advises to defer Performance late untill development and even beyond it. The way he puts it "Write Dumb Code" Search for the phase at http://java.sun.com/developer
One thing worth noticing in his article is he talks of keeping a performance metrics with yourself. This for me is like saying "Write that 100 Txn thingy somewhere, thats what we need to test for later".
This is a lot more serious than what meets eye, considering performance religiously while designing may lead to not enough generic design!
Its tricky but true its like saying have the performance criteria's with you but dont bother about them when getting things to work first.
I hope I have made my point clear ?Do reply and let me know what you think, I would love it if you could support it with a real life example it would be nice for all of us.
Thanks,
Ritesh
Addendum: Wikipedia for optimisation has famous quote by Donald Knuth on premature optimization:
http://en.wikipedia.org/wiki
No comments:
Post a Comment