软件开发中的两个东东碰不得( two traps in software development: history and multiple thread)

发布时间: 2012-08-27 22:40:00

两个东东碰不得:   (There're two kind of nightmares in the software requirement/development) 

1. 多个模型的历史记录,版本对比  (多表历史记录)  (multiple model history/revision)

2. 具有复杂流程的多线程。 ( multiple thread with somehow complicated business logic) 

其中第一个是最郁闷的。每做必挂。我认为以目前的数据库技术,无法有效解决多个模型的版本对比。(document based DB 的 embed 1 to many 除外,当然了,这个情况也不是最理想的)   ( Case 1. is definitely a very hard problem, I don't think there's a algorithm that could solve this problem -- although there's a case that a document base DB has a document embedding 1 to many relationship ) 

我在2007年自己做过这个,很难测试,难于维护,不稳定。不过幸好没怎么用。 ( I finished a task of case 1, the implementation is hard to test, hard to maintain and not stable at all ) 

我的两个同事也做过这个,其中一个同事因此离职,另一个同事写的代码基本没法看,更没法维护。他做完这个不久也离职了。( 2 of my workmates also have done this kind of job. One was fired by the boss about this issue, another one, who seems better,  has done the task, but the job was done very ugly and impossible to understand. BTW he also was fired after he finished that feature) 

二,多线程问题。记住:再复杂的问题,在多线程面前也是小巫见大巫。如果在单线程的情况下,这个问题的复杂度是1, 那么在多线程的情况下,它的复杂度就会变成100. 让你各种无语啊。 最恶劣的情况是:  难于测试,难于开发!  ( Case 2. the multiple thread programming. Remember:  Whatever complicated a problem is in a single thread context, it will be even more complicated in the multiple thread environment!   it seems no way to write the unit test (at least for me it is! ) )

今天先卖个关子,回头我把实际的需求和实现的代码发出来,一对比就知道了。。。  ( I will post the code and the implementation for this 2 issues later.  I promise you will learn a lesson.  )