软件开发环境(精品)

上传人:痛*** 文档编号:248308870 上传时间:2024-10-23 格式:PPT 页数:37 大小:295.50KB
返回 下载 相关 举报
软件开发环境(精品)_第1页
第1页 / 共37页
软件开发环境(精品)_第2页
第2页 / 共37页
软件开发环境(精品)_第3页
第3页 / 共37页
点击查看更多>>
资源描述
单击此处编辑母版标题样式,单击此处编辑母版文本样式,第二级,第三级,第四级,第五级,*,软件开发环境,郝宗波,haozb3,1.1,几个小测试,良好的编程风格和坚实的基础知识是良好的软件设计的基础。只有了解底层的基础才能设计出高层次的抽象。以下是几个相关测试。,1.1.1,关于数据大小的问题,struct,stru1,char c1;,short s;,char c2;,int,I;,;,请问,stru1,的大小(,Size,)是多少?,1.1.1,关于数据大小的问题,(,续,),struct,stru1 a;,printf(c1 %p, s %p, c2 %p, i %,pn,(unsigned,int)(void,*)&a.c1 - (unsigned,int)(void,*)&a,(unsigned,int)(void,*)&,a.s,- (unsigned,int)(void,*)&a,(unsigned,int)(void,*)&a.c2 - (unsigned,int)(void,*)&a,(unsigned,int)(void,*)&,a.i,- (unsigned,int)(void,*),运行,1.1.1,关于数据大小的问题,(,续,),struct,stru1,char c1;,char c2;,short s;,int,I;,;,请问,stru1,的大小(,Size,)又是多少?,运行,1.1.2,关于堆栈的问题,(1)Void loop();,Void,addr,();,Int,main(),addr,();,loop();,Long * p;,Void loop(),long i, j;,j = 0;,for (i = 0; i10;i+),(*p)-;,j+;,printf(“%dn,”, i);,void,addr,(),long k;,k = 0;,p = ,运行,int,a=0;,全局初始化区,char*p1;,全局未初始化区,main(),int,b;/,栈,chars=,abc,;/,栈,char*p2;/,栈,char*p3=123456;/ 1234560,在常量区,,p3,在栈上。,static,int,c=0,;,/,全局(静态)初始化区,p1=(char*)malloc(10); p2=(char*)malloc(20); /,分配得来得,10,和,20,字节的区域就在堆区。,strcpy(p1,123456);/ 1234560,放在常量区,编译器,/,可能会将它与,p3,所指向的,123456,优化成一个地方。,(2),int,main(),int,i;,int,a10;,for (i = 0; i = 10;,i +),ai, = 0;,printf(“%dn,”, i);,exit(0);,1.1.3,关于指针的问题,void,main(),int,* i;,allocateInt(i,);,printf,(“*i = %d”, *i);,void,allocateInt(int,* i),i = (,int,*),malloc(sizeof(int,);,*i = 3;,结果是什么,?,1.1.4,哪个访问的速度更快,(1),int,array1212;,int,I, J;,for (I = 0; I 12; I+),for(J,=0; J 12; J+),arrayIJ, = J;,(2)int array1212;,int,I, J;,for (I = 0; I 12; I+),for(J,=0; J,IPC,c)Ok,there is a directory,ipcdemos, I find!,Example2,: I want learn how to write network application.,a) locate the directory: c:program files,borland,delph6demos,b)Find,a Internet dir, and there is a chat subdirectory, Its good. We could Start.,2)Find Key features in,demos(use,find keyword in files).,Example,: I want to learn,interprocess,communication in,delphi, But I dont like guess.,a) I know some APIs from Windows SDK help, for example,WaitForSingleObject,b) Open Search GUI in windows. Input *.,pas(Delphi,Source code) and keyword:,WaitForSingleObject,c)We,find it,Debug it.,Problem:,I could not understand it, where to read from start?,a) Build it and Run.,b) learn to use it.,c) from the place that trigger some function, we set a breakpoint.,d)Run,it. From the breakpoint we could run the program step by step and watch the effect.,Example: The Chat program in,delphi,a)Run,the program the interface of Chat like that,b) We found if stroke enter key, the message will be sent.,The event handle has to be set in component memo. Find it in Object Inspector,c)There,is a event,OnKeyDown,has a handler “Memo1KeyDown” , Double Click it , then go to the code. Set a breakpoint there.,d)Run,the program in Delphi environment . Write some message in the memo and stroke enter. Step by Step (Use F7), we could trace the code that how to send message,4)For those dont have good GUI environment, try to find some good tools, for example using,source insight,to read c code in,linux,or,unix,.,How to read Lib :,1)When you familiar with the,lib(use,it), then try to read. ( VCL has 600000 and more lines),2)Debug it,3)when need extend some function of the lib, we have to trace the lib. Again and again, we will learn the ability how to locate the key code automatically.,4,),Use tools to abstract the code into Diagram.,JBuilder, together,modlemaker,etc.,1.4,选择哪种语言,?,选择哪种语言是软件设计和构架的开始。,一个语言提供了新的机制去支持新的方法学吗?,一个语言提供了一些措施去更多地使用系统的资源吗?,一个语言提供了很好的库支持你想完成的工作吗?,Compiling or interpreting?,是否遗产系统需要某种语言,?,一个语言提供了新的机制去支持新的方法学吗?,?,Structural programming divides big problem into small problem,.,Program is good for reuse.,Towards modularity,.,Typical languages: C, Pascal,Problems: data is separated from processing logic. Typical representative example: global variable.,Int,i,Void p(); void p2();, ,i = 12; if (i = 12) , ., ,Object-oriented programming divides problem into finer grain than structural programming.,Program is better for reuse.,Towards modularity,.,Typical languages: C+, java, Smalltalk,delphi,.,Problems: unable to parameterize type. The typical example is container like list. Bloated Code, and speed.,IntList,= class,FloatList,= class,Public,public,procedure,Add(i,: Integer); procedure,Add(f,: Real);, .,End; end;,Generic programming: Could use template to parameterize type.,Program is better for reuse.,Towards modularity,.,Typical languages: C+, java (JDK 1.5).,Problems: Bloated Code,Aspect-oriented programming: Could solve aspect problem in programming.,Typical languages: java . Now only weaver for java.,一个语言提供了一些措施去更多地使用系统的资源吗?,Does support embed assemble language? C/C+, Delphi. Assemble language could control hardware directly.,Could use system API easily? VB is not good. Java could use local calling to utilize system resources.,Could write driver? Some system only provides c routines.,Could safely use memory? garbage collection. Java, .net , lisp,smalltalk,.,Has handy error handling facility? C+ , java,delphi,has exception process facility. Assert is another good way. Using assert, we could easily find error in source code. Exception handling in java is rigorous.,Error return: mix error handling code and normal code. Error has to return in every layer of calling.,一个语言提供了很好的库支持你想完成的工作吗?,strong library behind the language is very important.,In enterprise application, J2EE is very good tool for enterprise application, for example, java bean, storage framework and so on.,Because of a lib, c+ become good at scientific calculation.,ACE make c+ be good at network programming.,VCL has Delphi component based programming easily.,Database framework makes,delphi,easily process database application.,structure component of VB is bad, so writing VB Component is difficult. At,the end, it just uses COM to replace the structure.,Features of Fortran make it suitable to scientific calculation,Compiling or interpreting?,Compiling is quicker. Like Delphi and C/C+,interpreting is slower. Like VB.,Compiling-interpreting: like Java , .net, and,smalltalk,.,Just in time compiling make java more like a compiling language.,是否遗产系统需要某种语言,?,if the system existing is written in some language, we have to choose it.,1.5,关于,Debug,Debug,的能力是开发有效软件的重要能力。,Debug,的过程也是深入了解系统核心的过程,是为坚实的软件构架提供基础知识的过程,是训练设计思路的过程。,发散思维特别重要,.,易用的好工具,.,关于多线程调试,,Logging,是很重要的,.,故事,:,有时在需要时发现窗体,Handle,已经释放。,有时在需要对象时,发现该对象已经被释放且悬空,.,边界条件的检查,.,人们往往忽视上下边界,.,故事,:,Strange invalid when running several time (Key violation).,1.6,设计模式是建立优秀软件架构的核心,软件构架从宏观上又分层,管道,黑板等结构。如果缺乏中间层次的支持,宏观的结构就是纸上谈兵。,了解和运用面向对象思想(即使使用非面向对象的语言)的关键是设计模式,支持软件架构的中间层次的架构就是设计模式。,深入了解对象模型,其来龙去脉,又是深刻理解设计模式的基础。因此,本课程将围绕对象模型,和设计模式展开。探讨这个层次上的软件构架和设计。,1.7,测试驱动的程序设计和开发,介绍自动单元测试。,并展示自动单元测试如何促使完善程序的设计软件的架构。,
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 管理文书 > 施工组织


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!