Well,its been some time since i penned for my blog. But better late than never… I came across a issue which was quite interesting. It had atleast 5k loc, which i was wondering like wat made the previous developer to code so much for a functionality,after all 5k is some amout of code right? Initially when i went through the code i was kind of felt that previous developer has compromisd with the OOP concepts ,and after understanding the code completely i felt like both the design and OOPs principle is compromised.
Now the problem is quite simple which involves checking for some elements if its same and offcourse the data is quite a lot, again the way the data objects were designed is some thing which i wanna forget as soon as possible. I think this code is the perfect example for “code smell” (any thought work guy will agree with it once he goes through that code :p)
So the problem is as simple as this , it has N number of data objects of set x and N number of objects of set y. it needs to be just verify if these data is same and there is certain constraints like say if some option is checked (ie in checkbox) or if some option is selected in the combobox , only that attribute needs to be verified.
So, when i am given to code , first and foremost thing i think is about the data structure of the data object. secondly the algorithm to use which results in maximum performance and least cost of both memory and CPU time , which is directly proportional to the number of passes you take to verify.
As the basic task is to just verify i would have used some generic algorithm which verifies any kind of data, (I would like to keep the explanation simple as i will be writing an algorithm in my next post).
secondly when there is a constraints, one thinks of using series of “If else ” conditionals , but offcourse your code clutters and i personally feel the “if else” conditionals is just too much for say N number of conditonals, and its bound to change later , so its important to use an “if else ” breaker design pattern🙂
The design abstract is some thing which is a combination of a proper use of data structure + verifying algorithm + “if else ” break design pattern thats it and if required we shall refactor the code once its done.
In my next post i will device both the algorithm and code in either java or groovy or python.
The main purpose of this title is because i had lots of questions which needs to be answered. they are as follows:-
- why developers wont follow the proved practice and why the management wont encourage to go with the proper design and allocate enough time for the same?
- why the OOP concept is compromised?
- why people just give excuses when asked about the good design and coding standards?
- Is management just worried about the productivity and is the good design and proved software development practices a cost we pay for it ?
- Do the management think about the maintenance problems with such a haphazard design?
- Is the concepts of “software engineering” and “system analysis and Design” which we studied is just meant for exams ?
- should Project managers(technical managers who review it ) be blamed for it or is it the software engineer responsible for it.
- In spite of knowing the repercussions of the bad design and horrible coding standards why many well known product based / service based companies dont bother to give importance to it?
Still i cant think of any answers for these…..