CS 325: Software Engineering March 24, 2015 Implementation Considerations Coding Standards Pair Programming Test-Driven Development.

Slides:



Advertisements
Similar presentations
Extreme Programming Alexander Kanavin Lappeenranta University of Technology.
Advertisements

Internal Documentation Conventions. Kinds of comments javadoc (“doc”) comments describe the user interface: –What the classes, interfaces, fields and.
Documentation 1 Comprehending the present – Investing in the future.
Case Tools Trisha Cummings. Our Definition of CASE  CASE is the use of computer-based support in the software development process.  A CASE tool is a.
PS4: Test Driven Development Based on Test Driven Development by Example By Kent Beck.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
1 Introduction to Software Engineering Lecture 42 – Communication Skills.
Computer Engineering 203 R Smith Agile Development 1/ Agile Methods What are Agile Methods? – Extreme Programming is the best known example – SCRUM.
CSE1301 Computer Programming: Lecture 13 Documentation.
Chapter 1 Principles of Programming and Software Engineering.
Xtreme Programming. Software Life Cycle The activities that take place between the time software program is first conceived and the time it is finally.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Test-Driven Development “Test first, develop later!” –OCUnit.
Test Driven Development Derived from Dr. Fawcett’s notes Phil Pratt-Szeliga Fall 2009.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 17 Slide 1 Extreme Programming.
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 02.
Comp 245 Data Structures Software Engineering. What is Software Engineering? Most students obtain the problem and immediately start coding the solution.
System Analysis and Design
Prologue: The Software Process. Main Phases of Software Process 1. Requirements Analysis (answers “WHAT?”) Specifying what the application must do 2.
Design-Making Projects Work (Chapter7) n Large Projects u Design often distinct from analysis or coding u Project takes weeks, months or years to create.
1 Chapter 5 Practice: A Generic View Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Teaching material for a course in Software Project Management & Software Engineering – part II.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Program Development Life Cycle (PDLC)
1 The Software Development Process  Systems analysis  Systems design  Implementation  Testing  Documentation  Evaluation  Maintenance.
Extreme/Agile Programming Prabhaker Mateti. ACK These slides are collected from many authors along with a few of mine. Many thanks to all these authors.
LECTURE 38: REFACTORING CSC 395 – Software Engineering.
Implementation 1. Software Implementation – transforming design into code Requirements Analysis Software Design Implementation Testing Deployment Evolution.
This chapter is extracted from Sommerville’s slides. Text book chapter
1 ENERGY 211 / CME 211 Lecture 26 November 19, 2008.
Rapid software development 1. Topics covered Agile methods Extreme programming Rapid application development Software prototyping 2.
SE: CHAPTER 7 Writing The Program
Triggers and Stored Procedures in DB 1. Objectives Learn what triggers and stored procedures are Learn the benefits of using them Learn how DB2 implements.
Chapter 7 Software Engineering Introduction to CS 1 st Semester, 2015 Sanghyun Park.
6/3/2016 CSI Chapter 02 1 Introduction of Flow of Control There are times when you need to vary the way your program executes based on given input.
Self-Documenting Code Chapter 32. Kinds of Comments  Repeat of code  Explanation of code  Marker in code  Summary of code  Description of code’s.
The Software Development Process
Lecture 4 – XP and Agile 17/9/15. Plan-driven and agile development Plan-driven development A plan-driven approach to software engineering is based around.
FORTRAN History. FORTRAN - Interesting Facts n FORTRAN is the oldest Language actively in use today. n FORTRAN is still used for new software development.
Chapter 7 Implementation. Implementation Approaches F Big bang –Code entire system and test in an unstructured manner F Top-down –Start by implementing.
Design and Planning Or: What’s the next thing we should do for our project?
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
Refactoring Agile Development Project. Lecture roadmap Refactoring Some issues to address when coding.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Software Development Process CS 360 Lecture 3. Software Process The software process is a structured set of activities required to develop a software.
Test Driven Development Introduction Issued date: 8/29/2007 Author: Nguyen Phuc Hai.
CS223: Software Engineering Lecture 18: The XP. Recap Introduction to Agile Methodology Customer centric approach Issues of Agile methodology Where to.
Chapter 16 Maintaining Information Systems. Objectives:  Explain and contrast four types of system maintenance.  Describe factors affecting maintenance.
Extreme Software Engineering A Hands-On Approach From Extreme Software Engineering: A Hands-On Approach Daniel H. Steinberg Daniel W. Palmer.
Software Maintenance1 Software Maintenance.
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
Extreme programming (XP) Advanced Software Engineering Dr Nuha El-Khalili.
Communicating in Code: Commenting Programming Studio Spring 2009 Note: several examples in this lecture taken from The Practice of Programming by Kernighan.
Software Development. The Software Life Cycle Encompasses all activities from initial analysis until obsolescence Analysis of problem or request Analysis.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. 4 Simple Flow of Control.
CS223: Software Engineering
Software Development.
Chapter - 8 Implementation.
Chapter 18 Maintaining Information Systems
Software Testing and Maintenance Modifying Code
Improving the structure of existing code
Communicating in Code: Commenting
Unit 6 Assignment 2 Chris Boardley.
Applied Software Project Management
Maintaining a Program In today’s lesson we will look at:
Computing Fundamentals
Maintaining Information Systems (SAD- 18)
Coding practices For IT and Computing students 2014.
Extreme Programming.
Presentation transcript:

CS 325: Software Engineering March 24, 2015 Implementation Considerations Coding Standards Pair Programming Test-Driven Development

CS 325 March 24, 2015 Page 189 Coding Standards Establishing coding standards for a software development process can be contentious, but has several concrete advantages: Provides a consistent level of code quality across teams and developers Facilitates project management, software integration, software reuse, software maintenance, version control, personnel transfer, code review, and software testing

CS 325 March 24, 2015 Page 190 Coding Standards: Indentation Kernighan & Ritchie Style (from The C Programming Language) int main(int argc, char *argv[]) { while (x == y) { while (x == y) { something(); something(); somethingelse(); somethingelse(); if (some_error) { if (some_error) { do_correct(); do_correct(); } else { } else { continue_as_usual(); continue_as_usual(); } } } finalthing(); finalthing();......} int main(int argc, char *argv[]) { while (x == y) while (x == y) { { something(); something(); somethingelse(); somethingelse(); if (some_error) if (some_error) { { do_correct(); do_correct(); } } else else { { continue_as_usual(); continue_as_usual(); } } } finalthing(); finalthing();......} int main(int argc, char *argv[]) { while (x == y) while (x == y) { { something(); something(); somethingelse(); somethingelse(); if (some_error) if (some_error) { { do_correct(); do_correct(); } } else else { { continue_as_usual(); continue_as_usual(); } } } finalthing(); finalthing(); } Allman Style (from Eric Allman’s ANSI C Documentation) Whitesmiths Style (from first commercial C compiler) Many argue that the particular coding standard used is less important than the fact that one is used.

CS 325 March 24, 2015 Page 191 Coding Standards: Comments When modifying code, always keep the commenting around it up to date. When modifying code, always keep the commenting around it up to date. At the beginning of every routine, it is helpful to provide standard, boilerplate comments, indicating the routine's purpose, assumptions, and limitations. A boilerplate comment should be a brief introduction to understand why the routine exists and what it can do. At the beginning of every routine, it is helpful to provide standard, boilerplate comments, indicating the routine's purpose, assumptions, and limitations. A boilerplate comment should be a brief introduction to understand why the routine exists and what it can do. Avoid adding comments at the end of a line of code; end-line comments make code more difficult to read. However, end-line comments are appropriate when annotating variable declarations. In this case, align all end-line comments at a common tab stop. Avoid adding comments at the end of a line of code; end-line comments make code more difficult to read. However, end-line comments are appropriate when annotating variable declarations. In this case, align all end-line comments at a common tab stop. Avoid using clutter comments, such as an entire line of asterisks. Instead, use white space to separate comments from code. Avoid using clutter comments, such as an entire line of asterisks. Instead, use white space to separate comments from code. Avoid surrounding a block comment with a typographical frame. It may look attractive, but it is difficult to maintain. Avoid surrounding a block comment with a typographical frame. It may look attractive, but it is difficult to maintain. Prior to deployment, remove all temporary or extraneous comments to avoid confusion during future maintenance work. Prior to deployment, remove all temporary or extraneous comments to avoid confusion during future maintenance work. If you need comments to explain a complex section of code, examine the code to determine if you should rewrite it. If at all possible, do not document bad code—rewrite it. Although performance should not typically be sacrificed to make the code simpler for human consumption, a balance must be maintained between performance and maintainability. If you need comments to explain a complex section of code, examine the code to determine if you should rewrite it. If at all possible, do not document bad code—rewrite it. Although performance should not typically be sacrificed to make the code simpler for human consumption, a balance must be maintained between performance and maintainability. Use complete sentences when writing comments. Comments should clarify the code, not add ambiguity. Use complete sentences when writing comments. Comments should clarify the code, not add ambiguity. Comment as you code, because most likely there won't be time to do it later. Also, should you get a chance to revisit code you've written, that which is obvious today probably won't be obvious six weeks from now. Comment as you code, because most likely there won't be time to do it later. Also, should you get a chance to revisit code you've written, that which is obvious today probably won't be obvious six weeks from now. Avoid the use of superfluous or inappropriate comments, such as humorous sidebar remarks. Avoid the use of superfluous or inappropriate comments, such as humorous sidebar remarks. Use comments to explain the intent of the code. They should not serve as inline translations of the code. Use comments to explain the intent of the code. They should not serve as inline translations of the code. Comment anything that is not readily obvious in the code. Comment anything that is not readily obvious in the code. To prevent recurring problems, always use comments on bug fixes and work-around code, especially in a team environment. To prevent recurring problems, always use comments on bug fixes and work-around code, especially in a team environment. Use comments on code that consists of loops and logic branches. These are key areas that will assist the reader when reading source code. Use comments on code that consists of loops and logic branches. These are key areas that will assist the reader when reading source code. Separate comments from comment delimiters with white space. Doing so will make comments stand out and easier to locate when viewed without color clues. Separate comments from comment delimiters with white space. Doing so will make comments stand out and easier to locate when viewed without color clues. Throughout the application, construct comments using a uniform style, with consistent punctuation and structure. Throughout the application, construct comments using a uniform style, with consistent punctuation and structure.

CS 325 March 24, 2015 Page 192 Pair Programming Extreme Programming advocates programming in pairs at one workstation to ensure better focus and stronger oversight. Unfortunately, this practice sometimes leads to tedium, inequity, or conflict.

CS 325 March 24, 2015 Page 193 Pair Programming Studies indicate that pairs spend about 15% more time on programs than individuals, but that the resulting code has about 15% fewer defects. By periodically switching between the roles of code-writer to code- reviewer, programmers share knowledge and experience, improve design quality and team communication, and generally express increased job satisfaction. Primary pairing variations: Expert-Expert: High productivity, low learning Expert-Novice: Good mentoring, potential for intimidation Novice-Novice: Sometimes more productive than novices working independently

CS 325 March 24, 2015 Page 194 Test-Driven Development One variation of extreme programming advocates beginning the implementation by developing tests that the software initially fails and then minimally adding code until the system passes the tests. E. Clean up code Go back to A and repeatGo back to A and repeat D. Run all tests If tests fail, go back to CIf tests fail, go back to C C. Write production code B. Check if test fails If test succeeds, go back to AIf test succeeds, go back to A A. Write a test Once the code minimally passes the tests, it is refactored to meet standards, and then the entire process begins again.

CS 325 March 24, 2015 Page 195 Test-Driven Development TDD has numerous benefits, including: Improved design (an emphasis on functionality needed by users) More modularized code, more focused classes, and looser coupling Fewer defects in final, delivered code TDD also has a few drawbacks, including: Emphasis on unit testing, neglecting integration or system testing GUIs, databases, network configurations require full functional testing Management may not support testing at the expense of coding