Software Engineering 3156 22-Oct-01 #14: Implementation Phil Gross.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

Programming for Beginners
Transition from C to C++ …and a Review of Basic Problem Solving.
MC697 Object-Oriented Programming Using Java. In this class, we will cover: How the class will be structured Difference between object-oriented programming.
Chapter 1: Introduction
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
Programming Creating programs that run on your PC
Programming Languages Language Design Issues Why study programming languages Language development Software architectures Design goals Attributes of a good.
Object-Oriented Analysis and Design Lecture 10 Implementation (from Schach, “O-O and Classical Software Engineering”)
Object-Oriented Enterprise Application Development Javadoc Last Updated: 06/30/2001.
Outline Java program structure Basic program elements
Programming Languages Structure
Fall 2007CS 2251 Software Engineering Intro. Fall 2007CS 2252 Topics Software challenge Life-cycle models Design Issues Documentation Abstraction.
Scott Grissom, copyright 2004Ch 3: Java Features Slide 1 Why Java? It is object-oriented provides many ready to use classes platform independent modern.
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
1 Implementation Xiaojun Qi. 2 Choice of Programming Language The language is usually specified in the contract But what if the contract specifies that.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
Languages and tools. BY SA machine code.
Program development & programming languages Chapter 13.
Javascript and the Web Whys and Hows of Javascript.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Chapter 13: Implementation Phase 13.3 Good Programming Practice 13.6 Module Test Case Selection 13.7 Black-Box Module-Testing Techniques 13.8 Glass-Box.
CSC 142 B 1 CSC 142 Java objects: a first view [Reading: chapters 1 & 2]
© 2006 Pearson Education 1 Obj: cont 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 –
CSE 219 Computer Science III Testing. Testing vs. Debugging Testing: Create and use scenarios which reveal incorrect behaviors –Design of test cases:
The Java Programming Language
CSC204 – Programming I Lecture 4 August 28, 2002.
JAVA JAVA is an object-oriented programming (OOP) language introduced by Sun Microsystems in In the Java programming language: A program is made.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
History of C 1950 – FORTRAN (Formula Translator) 1959 – COBOL (Common Business Oriented Language) 1971 – Pascal Between Ada.
Board Activity Find your seat on the seating chart Login – Remember your login is your first initial your last name and the last three numbers of your.
Clement Allen, PhD Florida A&M University SUMMER 2006.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
Compiling and the Java Virtual Machine (JVM). The syntax of Pseudocode is pretty loose –visual validation encourages a permissive approach –emphasized.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Introduction to Computer Programming CS 126 Lecture 2 Zeke Maier.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
CSC 142 B 1 CSC 142 Java objects: a first view [Reading: chapters 1 & 2]
PROGRAMMING GUIDELINES. SYLISTIC GUIDELINES  Meaningful names for identifiers Identifiers identify different parts of C++ programs. Identifiers should.
FORTRAN History. FORTRAN - Interesting Facts n FORTRAN is the oldest Language actively in use today. n FORTRAN is still used for new software development.
CSE 1341 Honors Note Set 2 1. Overview  Java vs. C++  Functions in C++  First Programming Packet  Development Environment 2.
CS 106 Introduction to Computer Science I 01 / 22 / 2007 Instructor: Michael Eckmann.
CPS120: Introduction to Computer Science Variables and Constants.
Implementation Phase Programming-in-the-many Programming-in-the-many Most real-life products are too large to be implemented by one programmer Most real-life.
CS 177 Recitation Week 1 – Intro to Java. Questions?
ITP 109 Week 2 Trina Gregory Introduction to Java.
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Information and Computer Sciences University of Hawaii, Manoa
Lecture 1b- Introduction
Working with Java.
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
CS0007: Introduction to Computer Programming
CSCI-235 Micro-Computer Applications
Key Ideas from day 1 slides
Programming Introduction to C++.
Introduction to C Topics Compilation Using the gcc Compiler
Java Intro III.1 (Fr Feb 23).
Chapter 10 Programming Fundamentals with JavaScript
Algorithm Efficiency, Big O Notation, and Javadoc
Chapter 1: Computer Systems
Chapter 1 Preliminary. Chapter 1 Preliminary 1.1 Reasons for Studying Concepts of Programming Languages Increased capacity to express ideas Improved.
Creating your first C program
Algorithm Correctness
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
Anatomy of a Java Program
Presentation transcript:

Software Engineering Oct-01 #14: Implementation Phil Gross

2 Administrivia Webboard – C’mon folks Homework 1 is here Homework 2 due tomorrow – Note minor update Our server is dead

3 Today’s class We’re ahead, so let’s keep on going Implementation basics

4 Choosing a programming language Note that this is occurring at the implementation phase; in reality may sometimes occur earlier, but you want the design to be mostly language-independent Consider cost of retraining – What if we asked you all to do this in C++? – Mutiny, right?

5 Historically… Most software was written in COBOL Currently, more COBOL code exists than anything else Approved by DoD in 1960: insisted any applications they would buy had to be in COBOL

6 Why COBOL? COBOL well-suited for data processing – Supports large numbers, for example – Report formatting capabilities Object-oriented COBOL? – Yup

7 Levels of languages Lowest: machine code – Next: assembly – mov $17, next Next: non-interpreted procedural languages – C, C++, Objective C, COBOL, FORTRAN Interpreted procedural languages – Java, Smalltalk, Perl, Python, Tcl, Ruby, LISP

8 Going on up 4 th -generation languages – Javascript, SQL – Loose typing (a = 5; a = “foo”;) – Less strict error-checking – Not necessarily procedural – Objective often end-user programming – Unsurprisingly, controversial – Success stories abound, however

9 Choosing a language What’s an appropriate language? – Most programs and designs today are object- oriented and procedural – Therefore, C++, Smalltalk, Java, Python, maybe Perl – Of these, C++ best if you have serious time constraints: the rest are interpreted to an extent or another

10 Languages (II) C++ also like C: large number of existing programmers – Not a superset, but close to it: most modern C++ compilers can compile and link against C code – We’ll be looking at C/C++ at the end of this class: useful for OS and DB courses at Columbia

11 Java So if C++ exists, why Java? – Java enables portable bytecode: not completely interpreted, yet not compiled to one machine platform – compromise between completely interpreted and completely compiled – Large, standardized API – Network/Internet oriented language – Yet, at the same time, still C-like

12 Good programming practice Variable naming Parameters Documentation Code layout Nested if’s Others? first link on Google, many others abound Java is your friend here

13 Variable naming “Consistent and meaningful” variable names – Bad: int f, g, h, i, j; – Bad: int freq, frequency, fr, frqncy; – Hungarian Naming Conventions: encode type info in variable names Used by Microsoft heavily Also applies to class naming

14 Parameters Handle constants properly – Don’t hardcode the numeric values in – public static final int port = 5378;

15 Comments (I) Self-documenting code – Yeah, right* – Given time, all code will become unreadable xCoordinateOfPositionOfRobotArm – too long So use xCoord Not good

16 Comments (II) Prologue comments: at the top of every module – Module name, brief description, programmer’s name, date, arguments, variable names, files accessed, names of files changed, module IO, error handling, test data filename, modifications made, dates – “Minimum information must be provided” – Aargh! This is overwhelming – More practical?

17 Comments (III) Janak’s personal tips™ – Use javadoc commenting – Put TODO’s at the top – Use “XXX” in problem areas – Trick: cvs can help comment your code Put $Log$ in a comment block – Profuse comments are not a bad thing – Use emacs or some editor that colors your code

18 Javadoc commenting ndex.html ndex.html Basically, /** * Comment * Comment for tag */ Done at class, variable, method levels

19 @exception

20 Code layout: bad public class HelloWorld{public static void main(String[] args) {System.out.println(“Hello world!”);System.exit(0);}} Take a look at the IOCCC – – My favorite: Othello

21 Code layout: good Proper indentation – Use an editor that will do most of the work for you: emacs is the best – pico, quite frankly, sucks for this Space is good! Use common bracing (open or closed)

22 Nested if, for vs. while if(a) { if(b) { … } } is much easier to read if phrased if(a&&b) {…} Although more if clauses this way, “shallower” code is generally better Use ? notation for small if statements for(int i=0; i < 10; i++) is much more compact than – int i=0; – while(i < 10) { … i++; }

23 Coding standards ex: Each module between 35 and 50 statements Good: makes code more uniform Bad: coding standards from above often ignored, hard to verify Goal: ease maintenance

24 Testing So you wrote all this stuff… Informal vs. methodical testing – Nonexecution-based testing (module review) vs. execution-based testing (test cases) – Testing to specifications (black-box) vs. testing to code (glass-box) Worst way to test: haphazard data

25 Testing to specifications? Can’t do exhaustive If a product has 20 different “factors”, with 4 values each, there can be a total of 4 20 or 1.1x10 12 different test cases Anyone got spare time on their hands? – If each case were tested once every 30 seconds, would take more than a million years

26 Testing to code? Execute each path in your module at least once? This flowchart has over possible paths! Also: how to test every path? Does it detect all of the faults?

27 Paths to completeness? Answer: no Just because you go through all the paths doesn’t mean your test cases cover everything Mini-example to the right: trivial, but representing more important

28 More path testing problems Can only test path if it’s present Conclusion: path testing is not reliable, but is valid

29 So, where do we go? Conclusion: we need a compromise – highlight faults, while accepting that not all faults will be detected Black-box test cases first (specifications) Then, develop additional glass-box techniques (code) To be continued…

30 What does this mean for you? Develop test plan: combination of black-box cases and glass-box cases Code using good principles! – We’ll release criteria as to what we’re expecting in the submitted implementation