1 / 37

Implementation

Implementation. CS 552 Spring ‘08. Figure 3: Kruchten’s “4 + 1”Model for Developing Software Architecture. + 1 Business Scenario. View 1. View 2. Process -- System Integrators. Logical -- End Users. + 1 Business Scenario. View 4. View 3. Development -- Programmers.

cwen
Download Presentation

Implementation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Implementation CS 552 Spring ‘08 CS 552 Spring 2008 Implementation

  2. Figure 3: Kruchten’s “4 + 1”Model for Developing Software Architecture + 1 Business Scenario View 1 View 2 Process -- System Integrators Logical -- End Users + 1 Business Scenario View 4 View 3 Development -- Programmers Physical -- Engineers This is an innovative and comprehensive integration of the abstractions needed to design the structure for writing system requirements. + 1 Business Scenario CS 552 Spring 2008 Implementation

  3. Development View -Tools • Coding Tools- map problem to solution domain; Concurrency • Testing tools- assures quality • Production tools- translates code into product. • System Management tools-OAM&P • Open Source • Documentation tools -record decisions and system changes. CS 552 Spring 2008 Implementation

  4. Code Review #include <stdio.h> #include <string.h> void foo(const char* input) { char buf[10];   printf(“My stack looks like: \n%p\n%p\n%p\n%p\n%p\n%p\n\n”);   strcpy(buf, input); printf(“%s\n”, buf);   printf(“Now the stack looks like: \n%p\n%p\n%p\n%p\n%p\n%p\n\n”); } CS 552 Spring 2008 Implementation

  5. Exercise Can you show how a static buffer overrun can be used to execute arbitrary code in this program? The objective is to find a flaw that has allows an input string that to execute a hack and insert a virus. CS 552 Spring 2008 Implementation

  6. Can you find the flaw • Detailed Design leads to fragile software or to robust software. • How could you prevent the ‘hack’ that can execute a virus? CS 552 Spring 2008 Implementation

  7. Now lets look at some examples of input: [d:\]StaticOverrun.exe Hello Address of foo = 00401000 Address of bar = 00401045 My stack looks like: 00000000 00000000 7FFDF000 0012FF80 0040108A < - - We want to overwrite the return address for foo 00410EDE to 00401045 which is the address of bar Hello Now the stack looks like: 6C6C6548 < - - You can see where “Hello” was copied in 0000006F 7FFDF000 0012FF80 0040108A 00410EDE CS 552 Spring 2008 Implementation

  8. Now for the classic test for buffer overruns – we input a long string [d:\]StaticOverrun.exe AAAAAAAAAAAAAAAAAAAAAAAA Address of foo = 00401000 Address of bar = 00401045 My stack looks like: 00000000 00000000 7FFDF000 0012FF80 0040108A 00410EDE AAAAAAAAAAAAAAAAAAAAAAAA < - - 24 A’s, A = 0x41 Now the stack looks like: 41414141 41414141 41414141 41414141 41414141 41414141 This would cause an application error message claiming the instruction at 0x41414141 tried to access memory at address 0x41414141 ! CS 552 Spring 2008 Implementation

  9. Now we want to try and find the location by feeding it different characters [d:\]StaticOverrun.exe ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 Address of foo = 00401000 Address of bar = 00401045 My stack looks like: 00000000 00000000 7FFDF000 0012FF80 0040108A 00410EDE ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 Now the stack looks like: 44434241 48474645 4C4B4A49 504F4E4D 54535251 58575655 CS 552 Spring 2008 Implementation

  10. We can see that the 54 stands for T and is on the line where we want to modify the return address to foo, so lets try this: [d:\]StaticOverrun.exe ABCDEFGHIJKLMNOPQRS Address of foo = 00401000 Address of bar = 00401045 My stack looks like: 00000000 00000000 7FFDF000 0012FF80 0040108A 00410EDE ABCDEFGHIJKLMNOPQRS Now the stack looks like: 44434241 48474645 4C4B4A49 504F4E4D 00535251 00410ECE CS 552 Spring 2008 Implementation

  11. Now we can see that if we could send it 0x45, 0x10, 0x40 instead of QRS we could get bar to execute, to do this we’ll have to use a perl script $arg = “ABCDEFGHIJKLMNOP”.”\x45\x10\x40”; $cmd = “StaticOverrun “.$arg; system(cmd); CS 552 Spring 2008 Implementation

  12. Running this script produces the desired result: [d:\devstudio\myprojects\staticoverrun]perl HackOverrun.pl Address of foo = 00401000 Address of bar = 00401045 My stack looks like: 00000000 00000000 7FFDF000 0012FF80 0040108A 00410EDE ABCDEFGHIJKLMNOPE?@ Now the stack looks like: 44434241 48474645 4C4B4A49 504F4E4D 00401045 00410ECA Augh! I’ve been hacked! CS 552 Spring 2008 Implementation

  13. How could you prevent the hack? • Check to make sure the input string does not exceed the buffer. • Add this code: if input > buffer exit, else strcpy(buf, input) CS 552 Spring 2008 Implementation

  14. Implementation Processes • Incremental Development • Component-based design. • Agile Methods. • Model Driven Development- maintains architectural integrity • Autonomic Computing — deals with system operation complexity. CS 552 Spring 2008 Implementation

  15. Agile Methods • Highly motivated and skilled individuals • Continuous customer collaboration • Minimizes risk with rapid iterative implementation • Small increments • Bottom up emphasis • Delivery of working software frequently - the measure of progress • Team work and collaboration vital CS 552 Spring 2008 Implementation

  16. Sprint Scrum Summary Feedback Control Standards, Conventions, Guidelines Product Backlog sQFD Sprint Backlog Sprint Planning Meeting Executable Product Increment Daily Scrum CS 552 Spring 2008 Implementation

  17. Model Driven Development . • Formal models may be executable • Traceability from requirements to implementation. • Complete development documentation to eliminate legacy code • Automatic code generation • Modifications and updates as design (not code) changes — avoids software aging or architectural drifts • Prototypes may become models. BUT the human thought process of transforming the design to implementation is still needed. This is a way to move to a higher level language. CS 552 Spring 2008 Implementation

  18. Information product delivery time Meir M. Current product information Lehman ~ 1980 legacy code Out of-date product information Time Legacy Code — M.M. Lehman Poorly documented source code that cannot be modified or updated because its exact operation is unknown. CS 552 Spring 2008 Implementation

  19. Open Source Code • The developer must be a user and there are: • No royalties • Accessible source code • Modifications and derivations are encouraged • No person, group or field of endeavor can be denied access to the program • The rights attached to the program must not depend on the program's being part of a particular software distribution • The licensed software cannot place restrictions on other software that is distributed with it. CS 552 Spring 2008 Implementation

  20. Free Open Source Software (FOSS) • The freedom to run the program, for any purpose • The freedom to study how the program works, and adapt it to your needs. Access to the source code is a must. • The freedom to redistribute copies so you can help others. • The freedom to improve the program, and release your improvements to the public, so that the whole community benefit. Access to the source code is again a must. CS 552 Spring 2008 Implementation

  21. FOSS Development Processes • Requirements as informal web notes - no apriori spec • Version Control and incremental releases- ‘committer’ • Zero Maintenance- evolutionary redevelopment • Layered Meritocracy with virtual project manager having source control and assignments • Explicit Software Technology Transfer as reported by Walt Scacchi UCSB CS 552 Spring 2008 Implementation

  22. Autonomic Computing Systems capable of running themselves, adjusting varying workloads — systems that allow users to concentrate on what they have to do, instead of how to do it. • Overcomes OAM&P complexity • Self-monitoring & self-configuring • Self-optimizing & self-adapting • Self-healing & self-protecting CS 552 Spring 2008 Implementation

  23. A brief aside on measurement • A fault leads to a failure. It is essential to count everything, not just serious ones, (25:1 spread has been observed between all faults and serious ones). • Systems are often compared in fault density, (faults per KLOC). This is a function of time. It only makes sense when comparing mature systems, (the asymptotic value). • Definitions of a line of code can vary considerably, (range of 2:1 in C). • Definitions of time also vary. For mean time to fail, it is the time of use ! CS 552 Spring 2008 Implementation

  24. Categories of post-delivery failures in 1997 Study CAA Canadian Aviation Authority This data suggests that major / minor failure ratio is somewhere between 5% and 10%. CS 552 Spring 2008 Implementation

  25. The NASA data CS 552 Spring 2008 Implementation

  26. CS 552 Spring 2008 Implementation

  27. Strategic importance of reliability Reliability is of strategic importance to companies. Why ? CS 552 Spring 2008 Implementation

  28. The growth in maintenance costs Source: US Quality Assurance Institute CS 552 Spring 2008 Implementation

  29. Software maintenance costs • The Microsoft Help Desk costs were reported by Bender (1996) at Star’96 as follows:- • Cost prior to Window’s 95 was 25,000 calls per day at an estimated $50-100 per call. • Assuming $75 average, this gives $684 million per year. • It is estimated to have jumped to 100,000 calls per day since Window’s 95, giving an overhead of approximately $2.5 billion per year. CS 552 Spring 2008 Implementation

  30. The distribution of Life-Cycle Costs Source: NASA, Arnold (1983), Boehm and others CS 552 Spring 2008 Implementation

  31. Programming Language Complexity • Fortran 77 ~ 150 pages • Ada83 ~ 280 pages • C90 ~ 190 pages • FORTRAN 90 ~ 400 pages • Ada95 ~ 600 pages • C++, (1998?) ~ 800 pages (and growing) CS 552 Spring 2008 Implementation

  32. Development Processes • Incremental Development: • Using incremental development, the functionality of the system is produced and delivered to our customer in increments. • Redirecting the project becomes far easier since one can incorporate changes quickly. • The incremental approach has allowed us to firstly focus on the essential features of the system. • Also, additional features can easily be implemented if time allows. CS 552 Spring 2008 Implementation

  33. Development Processes • Regression Testing: • It is a quality control measure to ensure that the newly modified code still complies with its specified requirements and that unmodified code has not been affected by the maintenance activity. • Regression testing is the selective retesting of a software system that has been modified to ensure that any bugs have been fixed and that no other previously working functions have failed as a result of newly added features. CS 552 Spring 2008 Implementation

  34. Release Plan • The game will be posted on the internet through our website for interested users to download and play. • The installation file will be posted along with our electronic user manual for our game. CS 552 Spring 2008 Implementation

  35. Coding Standards • Indentation • Tabs must be exactly 4 spaces • Long lines can be broken at coder’s prerogative. • Comments • Commenting should be used at a minimum; it should be used to explain the purpose of potentially confusing areas. • The “/* */” comments will be used to comment out blocks of code, rather than for descriptions, unless absolutely necessary. • Declarations • Variables will be defined at the beginning of functions. • Variables must be initialized before use; no initial values will be assumed. • Global variables • Globals should be used only when other methods will cause performance issues. • Major data variables will be shared among most modules. • Statements • Multiple statements per line are encouraged where code readability will profit. • Braces • When using braces “{ }” for blocks of code, they will occupy their own line. • Naming conventions • Names will use underscores to separate names (e.g., init_models()) • Constants will be defined in all capitals (e.g., TERRAIN_MAX_HEIGHT). • Capitals will not be used, except for in constants or where absolutely necessary. • File organization • Class definitions will be stored in separate header (.h) files. CS 552 Spring 2008 Implementation

  36. Lessons Learned • Other responsibilities • Classes: TCP/IP • Work • Communication • Start coding earlier • Start testing earlier • Slippage • Were too ambitious (caught up in the moment) • More design details • Lack of resources CS 552 Spring 2008 Implementation

  37. Ethics • Analyze safety and risks • Read the literature • Humanize tasks • Understand the problem, don’t just accepting the customer’s solution • Respect property rights and privacy • Ship systems that work • Advocate ethical behavior • Stand up and be counted. CS 552 Spring 2008 Implementation

More Related