DOC PREVIEW
UNCC ECGR 4101 - Disciplined Software Development

This preview shows page 1-2-3-24-25-26 out of 26 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Disciplined Software DevelopmentOverviewSoftware GoalsSoftware DesignWhy Bother?What is an Algorithm?Pseudo CodeSoftware Design ProcessData Logger General RequirementsSystem Tasks and Data FlowFlowchart Symbols (Control Flow)Flowchart for Process DepthFlowchart for Process Position and SaveFlowchart for Download DataCoding Style GuidelinesSlide 16Slide 17Slide 18Slide 19Slide 20Statistics on Software ProjectsAdvantages of SPI EffortsSo what is the CMM??Boeing’s SuccessHow do we mature through CMM?Software Development Environment9-1Embedded SystemsDisciplined Software DevelopmentLecture Notes 9Embedded Systems 9-2OverviewSoftware GoalsWhy design software before coding it?How should software be designed?How should software be coded (written)?Useful book (explains guidelines and much, much more)–The Practice of Programming, Brian W. Kernighan & Rob Pike, Addison Wesley 1999Embedded Systems 9-3Software GoalsSimplicity – program is short and simpleClarity – program is easy for humans and machines to understandGenerality – program can be used for a broad range of situationsEmbedded Systems 9-4Software DesignHow do you think companies create software? Just dive in and start writing code, or Plan the architecture and structure of the software?Software is like any engineering project - you need to identify WHAT you want to do and HOW you want to get there. WHAT = requirements HOW = development processHow do you know you developed the software successfully? Compare the finished product to the requirements (compliance)Embedded Systems 9-5Why Bother?“He who fails to plan, plans to fail”Most companies have an established process for developing hardware and software.Software development processes can differ between companies, or even between projects in the same company.Software development can occur at the same time that hardware is designed (co-development), especially with embedded products. A delay in either affects the timing of the other.Embedded Systems 9-6What is an Algorithm?A formula? A solution? A sequence of steps? A recipe?A former Vice-President? (Al-Gore-ithm?)An algorithm is created in the design phaseHow is an algorithm represented?Typically represented as pseudo codeHistorically represented as flowchartsDo yourself a favor – write algorithms before code – always!Embedded Systems 9-7Pseudo CodePseudo code is written in English to describe the functionality of a particular software module (subroutine)Include name of module/subroutine, author, date, description of functionality of module, and actual stepsOften you can take the pseudo code and use them lines in your program as comments!Avoid a very fine level of detail (although this may sometimes be difficult to do)Avoid writing code – use English, not assembly language (or higher-level language) instructionsEmbedded Systems 9-8Software Design ProcessStudy the problem FIRST (THINK!!).Write the important parts of your problem down.Break the problem into manageable pieces. Solve each of the pieces individually.Write an algorithm of the solution of your problem, or for each piece you identified.Create test cases for yourprogram (more later).Write the code. Include comments as you code.Test your programEmbedded Systems 9-9SONARData Logger General Requirements Three operating modes–Standby–Record•Get depth information from Sonar via UART0•Get position information from GPS via UART2•Store most recent depth from each position in DataFlash–Download: Download depth and position information from DataFlashDepthNMEA 0183 4800 baud RS232Lat/LonPositionNMEA 0183 4800 baud RS232DataFlashMemoryDataFlashMemoryOff-line DataProcessingGPSDebuggerSPIRS232+ USBDownloadRS232Embedded Systems 9-10System Tasks and Data FlowUART0Rx ISRUART2Rx ISRUART2Tx ISRProcessDepthProcessPositionand SaveCurDepthCurPosSONARGPSDataFlashMemoryDataFlashMemoryUserInterfaceGlobal VariableISR TaskMemUsedDownloadDataU0RxQU2RxQU2TxQEmbedded Systems 9-11Flowchart Symbols (Control Flow)Decision?Do a TaskInput/ OutputSTARTENDYesNoEmbedded Systems 9-12Flowchart for Process DepthExecutes each time a complete NMEA 0183 sentence arrives through Sonar UART (#0)–Rely on that Receive ISR to detect end of sentenceStartDecode NMEASentenceInvalid?EndYNUpdate CurDepthU0RxQData InData OutEmbedded Systems 9-13Flowchart for Process Position and SaveStartDecode NMEASentenceInvalid?EndYNUpdate CurPosSkip?YNWrite toDataFlashUpdate MemUsedU2RxQData InData OutData OutExecutes each time a complete NMEA 0183 sentence arrives through GPS UART (#2)–Rely on that Receive ISR to detect end of sentenceEmbedded Systems 9-14Flowchart for Download DataStartDone with download?EndYNEnqueueExecutes each time U2TxQ becomes empty (determined by U2 Tx ISR)ReadDataFlashU2TxQData OutTx Queue full?YNEmbedded Systems 9-15Coding Style Guidelines1. Names1. Use descriptive names for global variables, short names for locals2. Use active names for functions (use verbs): Initialize_UART3. Be clear what a boolean return value means! Check_Battery vs. Battery_Is_Fully_Charged2. Consistency and idioms1. Use consistent indentation and brace styles2. Use idioms (standard method of using a control structure): e.g. for loop 3. Use else-if chains for multi-way branchesEmbedded Systems 9-16Coding Style Guidelines3. Expressions and statements1. Indent to show structure2. Make expressions easy to understand, avoid negative tests3. Parenthesize to avoid ambiguity4. Break up complex expressions5. Be clear: child = (!LC&&!RC)?0:(!LC?RC:LC);6. Be careful with side effects: array[i++] = i++;Embedded Systems 9-17Coding Style Guidelines4. Macros1. Parenthesize the macro body and arguments#define square(x) ((x) * (x))5. Magic numbers1. Give names to magic numbers with either #define or enum#define MAX_TEMP (551)enum{ MAX_TEMP = 551, /* maximum allowed temperature */ MIN_TEMP = 38, /* minimum allowed temperature */ };2. Use character constants rather than integers: if ch==65 ???? if ch ==‘A’3. Use language to calculate the size of an object: sizeof(mystruct)Embedded Systems 9-18Coding Style Guidelines6. Comments1. Clarify, don’t confuse2. Don’t belabor the obvious3. Don’t comment bad code – rewrite it instead4. Don’t contradict the codeEmbedded Systems 9-19Coding Style Guidelines7. Use a standard comment block at the entry of each function1. Function Name2. Author Name3. Date of each modification4. Description of what function does5. Description of arguments6.


View Full Document

UNCC ECGR 4101 - Disciplined Software Development

Documents in this Course
Load more
Download Disciplined Software Development
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Disciplined Software Development and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Disciplined Software Development 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?