该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2007-09-07
接口驱动,点点实践中。
要做的事情高人们已给规划出来了,你只要去实现他就OK了。 以一个菜鸟的眼光看,确实不错! |
|
返回顶楼 | |
发表时间:2007-09-07
chenk85 写道 再好的设计也是重构得到的,如果一开始就放入大量的设计模式,那这个设计是过度设计。既然是用TDD,那一开始的代码或许就是没什么设计技巧的代码,通过持续的重构,代码的设计才能变得漂亮起来。坚持用TDD就不存在楼上的同学讲的情况,因为不会过度设计。
好像还是不明白楼主对CTO的工作的看法。 过渡设计不好,不过我们不需要为了展示一下重构,就“那一开始的代码或许就是没什么设计技巧的代码”? |
|
返回顶楼 | |
发表时间:2007-09-07
看了評論,感覺自己做外包(coding)看來是沒有前途了!
|
|
返回顶楼 | |
发表时间:2007-09-07
哎,做了几个项目后,发现自我的设计水平都很差,所以现在一般都在看设计方面的资料,以前以为会代码开发就很牛了,现在发现自己还太差,学习楼上的设计,一直比较喜欢TDD(测试驱动开发)无耐一写就乱了,真该好好补补课了
|
|
返回顶楼 | |
发表时间:2007-09-07
SunMicro 写道 在项目中也一直在尝试Interface design和测试驱动,不过有时候会有一种立即实现的冲动,特别是在对一些接口设计感觉不自信的情况下,希望通过具体实现来验证,然后不知不觉就又陷入了细节考究之只中。
同感,可能还是技术不到家吧,对自己没有信心,还是需要多接触些项目,累计经验才能出现好的Interface design.
|
|
返回顶楼 | |
发表时间:2007-09-07
SunMicro 写道 在项目中也一直在尝试Interface design和测试驱动,不过有时候会有一种立即实现的冲动,特别是在对一些接口设计感觉不自信的情况下,希望通过具体实现来验证,然后不知不觉就又陷入了细节考究之只中。
真他妈的同感!不知道如何解决这个坏习惯。 |
|
返回顶楼 | |
发表时间:2007-09-07
是的,CTO是不会干这种事情的.CTO是在整个公司的技术发展方向上作引导,更多关心业界的动向和公司的发展.
只能说CTO曾经是干过这些的. |
|
返回顶楼 | |
发表时间:2007-09-07
JavaVision 写道 锁上门睡觉 写道 看了評論,感覺自己做外包(coding)看來是沒有前途了!
我不觉得, 其实我们的水平也就是干干苦力的料,搞什么设计呵呵,邯郸学步罢了。 应该说你没见过牛人,所以不要把这些人也包含进去 |
|
返回顶楼 | |
发表时间:2007-09-07
下面也是老外写的....
你觉得哪个更有意思呢? String query = null; //Time to do some fancy SQL building if (code == CLIENTHOURS_PROJECTS) { //select = projects with hour count checkNull(ids, 1); query = "select " + "(select sum(r.hours) from registeredhours r where r.project_id = p.id) AS COUNT, " + "p.id, p.name " + "from project p " + "where p.client_id = " + ids[0]; } else if (code <= CLIENTHOURS_MODULES_ON_PROJECT_ACTIVITY_EMPLOYEE) { //select = modules with hour count, where = project constraint query = "select " + "(select sum(r.hours) from registeredhours r where r.module_id = m.id "; String from = ") AS COUNT, " + "m.id, m.name " + "from module m " + "where m.project_id = "; if (code == CLIENTHOURS_MODULES_ON_PROJECT_ACTIVITY) { //where += activity constraint checkNull(ids, 2); String where = " and activity_id = " + ids[1]; query += where + from + ids[0] + " and m.id in " + "(select distinct module_id from registeredhours where project_id = m.project_id " + where + ")"; } else if (code == CLIENTHOURS_MODULES_ON_PROJECT_EMPLOYEE) { //where += employee constraint checkNull(ids, 2); String where = " and employee_id = " + ids[1]; query += where + from + ids[0] + " and m.id in " + "(select distinct module_id from registeredhours where project_id = m.project_id " + where + ")"; } else if (code > CLIENTHOURS_MODULES_ON_PROJECT) { //where += activity AND employee constraint checkNull(ids, 3); String where = " and activity_id = " + ids[1] + " and employee_id = " + ids[2]; query += where + from + ids[0] + " and m.id in " + "(select distinct module_id from registeredhours where project_id = m.project_id " + where + ")"; } else { //no additional constraint checkNull(ids, 1); query += from + ids[0]; } } else if (code <= CLIENTHOURS_ACTIVITIES_ON_NO_PROJECT_EMPLOYEE) { //select = activities with hour count query = "select " + "(select sum(r.hours) from registeredhours r where r.ACTIVITY_ID = a.id "; String from = " ) AS COUNT, " + "a.id, a.name " + "from activity a "; if (code < CLIENTHOURS_ACTIVITIES_ON_NO_PROJECT) { //where is project constraint String where = "where a.id in (select distinct activity_id from registeredhours where "; if (code == CLIENTHOURS_ACTIVITIES_ON_PROJECT_MODULE) { //where += module constraint checkNull(ids, 2); String where2 = " project_id = " + ids[0] + " and module_id = " + ids[1]; query += " and " + where2 + from + where + where2 + ")"; } else if (code == CLIENTHOURS_ACTIVITIES_ON_PROJECT_EMPLOYEE) { //where += employee constraint checkNull(ids, 2); String where2 = " project_id = " + ids[0] + " and employee_id = " + ids[1]; query += " and " + where2 + from + where + where2 + ")"; } else if (code > CLIENTHOURS_ACTIVITIES_ON_PROJECT) { //where += module AND employee constraint //(code == CLIENTHOURS_ACTIVITIES_ON_PROJECT_MODULE_EMPLOYEE) checkNull(ids, 3); String where2 = " project_id = " + ids[0] + " and module_id = " + ids[1] + " and employee_id = " + ids[2]; query += " and " + where2 + from + where + where2 + ")"; } else { //no additional constraint checkNull(ids, 1); String where2 = " project_id = " + ids[0]; query += " and " + where2 + from + where + where2 + ")"; } } else { //where is no_project constraint String where = "where a.id in (select distinct activity_id from registeredhours where "; if (code == CLIENTHOURS_ACTIVITIES_ON_NO_PROJECT_EMPLOYEE) { //where += employee constraint checkNull(ids, 2); String where2 = " project_id is null and client_id = " + ids[0] + " and employee_id = " + ids[1]; query += " and " + where2 + from + where + where2; } else { checkNull(ids, 1); String where2 = " project_id is null and client_id = " + ids[0]; query += " and " + where2 + from + where + where2; } query += ")"; } } else { //select = employees with hour count query = "select " + "(select sum(r.hours) from registeredhours r where r.employee_id = e.id "; String from = ") AS COUNT, " + "e.id, "+DBConnectionUtil.getSQL("CONCAT_NAME")+" AS name " + "from employee e "; if (code < CLIENTHOURS_EMPLOYEES_ON_NO_PROJECT) { //where is project constraint String where = "where e.id in (select distinct employee_id from registeredhours where "; if (code == CLIENTHOURS_EMPLOYEES_ON_PROJECT_MODULE) { //where += module constraint checkNull(ids, 2); String where2 = " project_id = " + ids[0] + " and module_id = " + ids[1]; query += " and " + where2 + from + where + where2 + ")"; } else if (code == CLIENTHOURS_EMPLOYEES_ON_PROJECT_ACTIVITY) { //where += activity constraint checkNull(ids, 2); String where2 = " project_id = " + ids[0] + " and activity_id = " + ids[1]; query += " and " + where2 + from + where + where2 + ")"; } else if (code > CLIENTHOURS_EMPLOYEES_ON_PROJECT) { //where += module AND activity constraint //(code == CLIENTHOURS_EMPLOYEES_ON_PROJECT_MODULE_ACTIVITY) checkNull(ids, 3); String where2 = " project_id = " + ids[0] + " and module_id = " + ids[1] + " and activity_id = " + ids[2]; query += " and " + where2 + from + where + where2 + ")"; } else { //no additional constraint checkNull(ids, 1); String where2 = " project_id = " + ids[0]; query += " and " + where2 + from + where + where2 + ")"; } } else { //where is no_project constraint String where = " where e.id in (select distinct employee_id from registeredhours where "; if (code == CLIENTHOURS_EMPLOYEES_ON_NO_PROJECT_ACTIVITY) { //where += employee constraint checkNull(ids, 2); String where2 = " project_id is null and client_id = " + ids[0] + " and activity_id = " + ids[1]; query += " and " + where2 + from + where + where2; } else { checkNull(ids, 1); String where2 = " project_id is null and client_id = " + ids[0]; query += " and " + where2 + from + where + where2; } query += ")"; } } log.debug("Performing Klant beheer uren query: " + query); |
|
返回顶楼 | |
发表时间:2007-09-07
老外程序员牛人有,鸟人水平也就那样,你自己看看apache那些开源项目中的代码
乱七八糟的多的是,没有必要妄自菲薄 JavaVision 写道 chenk85 写道 再好的设计也是重构得到的,如果一开始就放入大量的设计模式,那这个设计是过度设计。既然是用TDD,那一开始的代码或许就是没什么设计技巧的代码,通过持续的重构,代码的设计才能变得漂亮起来。坚持用TDD就不存在楼上的同学讲的情况,因为不会过度设计。
好像还是不明白楼主对CTO的工作的看法。 国内程序员那点鸟水平, 有多少人敢用tdd |
|
返回顶楼 | |