工作学习 / 学科技术讨论 / 共享经验 - Poor Coding. I have been programming for over 20 years and I saw so many bad coding examples and I hope you can share your experience with us. WHAT YOU SHOULD NEVER DO!
-hkchan(0);
2009-11-14(#5680118@0)
<<Refactoring: Improving the Design of Existing Code>>
<<Code Complete>>
-wincity(toad);
2009-11-14(#5680177@0)
This is one of the consulting services that I provide to my clients. But you have to make them aware the benefit of optimized code / problem of spaghetti code. My marketing approach is more on education, to educate my prospective clients.
-hkchan(0);
2009-11-14(#5680188@0)
I worked on a legacy system. There are about 80 tables in a database and all tables has column names C1, C2, C3, ..., C100. No PK, FK, index, etc. No stored procedures. No data dictionary.To get exact meaning of a column, especially in some cases, they needed to dig into source codes that were probably named module1_func1, module1_func2, .., modulen_funcm.
The leader developer was promoted several time to a high position and he considered the system as his own baby. It's not allowed to criticize the system.
-wangqingshui(忘情水);
2009-11-14{328}(#5680224@0)
Did we work for the same company before? And to make it even challenging, each column is actually a zip content of a big block of data; they argue it would improve the performance.
-hkchan(0);
2009-11-14(#5680312@0)
It seems not. But that company has another way to manage data and they totally didn't benefit from database systems either. I do not want to expose details. So it seems many company do these bad things and make money.
-wangqingshui(忘情水);
2009-11-15(#5681593@0)
Thanks, I am trying!
-hkchan(0);
2009-11-15(#5681533@0)
Do NOT access database table or class directly, use view or interface.
-hkchan(0);
2009-11-15(#5681550@0)
Do not use view in database, that's the worse thing I can think of.
-oceanwater(灌水日月长);
2009-11-19(#5691281@0)
If you have this rule I can say you don't do a good job in coding. Don't make up stupid rules if the system DOES allow you to do so and it easy to read. Does the VIEW make maintainance easier or performance better?
-iberry(iberry);
2010-3-10(#5936988@0)
硬件也一样。。俺老板最有名的一句话。I don't care what's going on. Just fix it
-z24(Quick! Winterizing);
2009-11-15(#5681637@0)
They called it bandit apporach. My question is always if you want to fix the source or just the symptoms . Fixing the symptoms can be quick and easy but without fixing the source, there would be more symptoms coming back very soon.It adds up quick.
-hkchan(0);
2009-11-15{17}(#5681839@0)
It's all about the job security. Nobody give a damn about the quality of code, nobody.The better the system maintainable the quicker you got your ass kicked out.
People sick from time to time so doctor and nurse got work to do, people create garbage everyday so garbage worker can strike to increase the rate, salt and weather in Toronto guarantee work for road maintenance, the only hope of developer is the bug you hosted yourself.
Well, it's another story if you maintain your own code with job security.
This is another version of '劣币驱逐良币'
-james4rn(james);
2009-11-15{476}(#5681931@0)
So, the best way is to do Quick Fix first; and make it more 'spaghetti' and harder to read. Fxxx them all!
-skitennis(tennisfan);
2009-11-19(#5691168@0)
totally wrong, it is acceptable to start with a workable approach, and the next thing is to make it clean. Depending on personality, some people may do the second part, some may not
-sowen(昂居居);
2010-3-5(#5924890@0)
Code without unit test
-spruce(toastmaster);
2010-2-24(#5904351@0)
真心话 or 鹦鹉学舌?
-dragonlover(叶公);
2010-3-5(#5924869@0)
after year 2002, i have never wrote code without unit test.
-spruce(toastmaster);
2010-3-5(#5926534@0)
never say nerver:). i.e sometimes I keep the redundant code just because I want to leave space for the uncertainty.
-frankwoo(柳五随风);
2010-3-8(#5932031@0)