Professional Documents
Culture Documents
INTRODUCTION TO SOFTWARE
ENGINEERING 2
Lecturer:
Lectures:
Tuesday 3 - 4 pm and Thursday 3 - 5 pm,
room NURSTH
Workshops in ES409 (five possible times).
Assignments:
2 assignments, deadlines in course outline.
LATE ASSIGNMENTS will lose 10% per day or part thereof.
Assessment:
Tue 5pm-7pm
Thu 11am-1pm
Thu 1pm-3pm
Fri 9am-11am
Fri 11am-1pm
TEXTBOOKS SENG1120/SENG6120
Teaching Assistants
Laboratories commence in
week 2 of semester
Register yourself in any lab
session
Communication
Programming Language
Development
Environment
NOT BE USED!!!!
Development
Environment
*** Assignments will be marked as per above.
If you use an IDE to do your work, ensure
that your submission is compatible with the
tools that will be used to mark it ***
Computers in ES409 have cygwin and Visual
Studio installed. If you develop your code
using Visual Studio, NetBeans, Eclipse, Borland
C++, etc, just make sure it compiles and runs
under cygwin.
This is VERY important. When marking, if your
code does not compile and runs, you will
likely lose 50% of the marks straightaway,
because we wont be able to test it.
Plagiarism:
What is C++?
A programming language based on
the language C that was
developed by Dennis Richie in 1972.
C++ was created by Bjarne
Stroustrup in 1979.
C++ is not C. It includes modern
constructs that provide support for
object-oriented programming
techniques
C++ had a big influence on James
Goslings development of the Java
programming language.
C++:
Has as a major design priority
that the same C program should
run as fast when compiled with a
C as a C++ compiler
So there is no run-time bounds
checking and no garbage collection
Java:
Implements the most commonlyused C++ techniques when there
are multiple available in C++
Does not implement features that
were open to abuse in C++
Tries to prevent the execution of
incorrect programs
By increasing error checking by the
compiler
By having the Virtual Machine (VM)
throw exceptions for run-time faults
Speed:
Initially, C++ programs ran much
faster than Java programs
Improvements in compiler and
virtual machine technology have
closed the gap
However, the absence of run-time
error checking should result in
equally well written C++ code
running faster than the equivalent
Java code
Some Differences
Some Differences
Program Template
Makefiles
A sample
is
provided on
Blackboard
Makefile
CC=g++
CFLAGS=-c -Wall
LDFLAGS=
SOURCES=test.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=test
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm -rf *.o core
Software Development
Task specification
Solution design
Implementation of the solution (coding)
Analysis of the solution
Testing and debugging
Maintenance and evolution
Obsolescence
plus continuous DOCUMENTATION
Sample Problem
Let us use a simple problem to
demonstrate the stages:
Given an interval set by the user
(e.g. -10, 40), display a table for
converting Celsius temperatures to
Fahrenheit as displayed below:
Fahrenheit
-10.0C
Display degrees
-9.0C
F in this column
after they
have been
computed
35.0C
36.0C
37.0C
38.0C
39.0C
40.0C
The algorithm
Pseudocode
c is a celsius
Declared Constants
Checking Preconditions
Feedback to the
Operating System
return EXIT_SUCCESS;
Testing:
Involves running a program and
observing what it does
Only verifies program behaviour for the
particular input used
The tester observes correctness of output,
and temporal program performance
Test Data
Debugging
DO NOT:
Change suspicious code just hoping
things will get better
Assume that even controlled
rectification will not change things that
previously worked properly
It is a truism that it is more important when
performing maintenance to ensure that what
previously worked continues to work than it
is to ensure the new feature works properly.
Exception handling
Exception handling
#include <iostream>
using namespace std;
int main()
{
int StudentAge;
cout << Enter student age: ";
cin >> StudentAge;
try {
if(StudentAge < 0) throw;
cout << "\nStudent Age: " << StudentAge << endl;
}
catch(...)
{
cout << Student age is negative << endl;
return -1;
}
cout << "\n";
return 0;
}
Exception handling
Types of exception:
throw: generic exception; catch()
throw <type>: throws a type
Any limitations
1.
2.
3.
4.
5.