+ All Categories
Home > Documents > Department of Information Engineering 1 IEG3080 Software Engineering About this course...

Department of Information Engineering 1 IEG3080 Software Engineering About this course...

Date post: 01-Apr-2015
Category:
Upload: tristian-bayard
View: 216 times
Download: 0 times
Share this document with a friend
Popular Tags:
33
1 Department of Information Engineering IEG3080 Software Engineering About this course Object-oriented programming C# Design Patterns Software Methodologies 4 assignments + 1 project No mid-term Open-note exam (one A4 paper) Homepage: http://course.ie.cuhk.edu.hk/~ieg3080a
Transcript
Page 1: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

1Department of Information Engineering

IEG3080 Software Engineering

• About this course– Object-oriented programming– C#– Design Patterns– Software Methodologies

• 4 assignments + 1 project• No mid-term• Open-note exam (one A4 paper)• Homepage:

http://course.ie.cuhk.edu.hk/~ieg3080a

Page 2: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

2Department of Information Engineering

• Project – 30%• Assignment –10%• Exam – 60%

• Instructor: Prof. M. Chang

• Reference text– Design patterns by Gamma et al (Addison

Wesley)

– www.wikipedia.org

Page 3: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

3Department of Information Engineering

•No plagiarism– Penalties includ failing the

course and receiving demerits.

• Read this web site– http://www.cuhk.edu.hk/policy/

academichonesty/

Page 4: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

4Department of Information Engineering

Disclaimer

• Put the following disclaimer in all your work and signed

• "I understand the University guidelines on academic honesty as shown in the web page http://www.cuhk.edu.hk/policy/academichonesty/ and I agree to comply with the guidelines. I declare that I do not plagiarize or cheat in any way that violates the spirit of the guidelines. I understand the severity of disciplinary action should the guidelines be violated.

Signed (Student _____________________)"

Page 5: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

5Department of Information Engineering

What is software engineering?

• How to build large-scale software by a large team of people efficiently?

• The problem– Software is complex

• The consequences– Software is expensive– Delivery is always late– Software is unreliable– Software is difficult to maintain

• the code is written by other people– Software is difficult to adapt to future change– Difficult to manage a large team

Page 6: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

6Department of Information Engineering

Technical solution

• Reusable software (reliable, low-cost, fast)– Source code reuse

•But vendors give the source code away– Binary code reuse

•How to add things to binary code?– Implementation and interface reuse

• Interface reuse – flexible software – Design pattern reuse

•Solutions to common programming problems

Page 7: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

7Department of Information Engineering

Management solution

• Effective communication

• How to manage a team– People has different skills– Turnover– Communicate in a large team– Quality of the software

• How to manage the customers– How to collect the requirements– Are we building the system that the

customers want?

Page 8: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

8Department of Information Engineering

Management tools

• Software methodologies– Traditional methods– Rational Unified Process– Extreme Programming (XP)

• CASE tools– UML - schematic diagram for software– NUnit – for regression testing of software

Page 9: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

9Department of Information Engineering

Software is complex

• How to deal with complex system?

• Universal solution - Divide and conquer– Divide a complex system into meaningful

parts•Each part can be developed and modified

independently from each other

• Big question– How to divide a system into meaningful parts

• Main issue– The interface between parts

Page 10: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

10Department of Information Engineering

疱丁解牛

Page 11: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

11Department of Information Engineering

To divide a system into meaningful parts

• A decomposed cow

Head

Body

FrontLeg

ReadLeg

Page 12: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

12Department of Information Engineering

Is software easy to change?

• Good software will be used for many years• Must be able to extend/add/modify the software

in order to cater for future needs

• Is software easy to change?– Look easy, but in fact difficult !!

• Why?– Too many dependencies between different

modules – 牽一發而動全身

Page 13: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

13Department of Information Engineering

Solution?

• Reduce dependency between parts– The key to flexible and extensible software– Related concepts

•Modularity, loose coupling, encapsulation, information hiding, etc

• Reduce dependency is a general principle in many fields– In mathematics - Eigen value decomposition– In database – normalization of tables

Page 14: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

14Department of Information Engineering

• Hardware is inherently modular– e.g. a hardware chip

• Software is NOT !– Data spreads all over the system, rather than

located in one place– Spaghetti code

• What should be done– Locked the data and functions in one place– Object = function + data

Page 15: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

15Department of Information Engineering

Interface – so that parts can be changed independently

Head

Body

FrontLeg

ReadLeg

Interface

Page 16: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

16Department of Information Engineering

To replace a head

New Head

Body

FrontLeg

ReadLeg

Interface

Page 17: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

17Department of Information Engineering

Interface and Implementation

• Interface is a specification, describing how parts should be joint

• Implementation is the real stuff (the code)

• Interface is MORE IMPORTANT than implementation– Why?– Interface, once decided, is hard to change

• e.g. the size of the thread of screws– Implementation can be easily changed, e.g.

the screw

Page 18: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

18Department of Information Engineering

Inheritance

• Inheritance is fundamental in OOP. What does it mean?– “the inheritance of an interface by an

implementation”

• OOP is about interface inheritance, not implementation inheritance

• Interface inheritance– Reuse of the interface specification

• Implementation inheritance– Reuse of code– Useful but not the most important principle in OO

Page 19: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

19Department of Information Engineering

Inheritance

• Example– Interface

•USB specification (just a piece of paper, totally abstract)

– Implementation•MP3 player•Digital camera•Mobile phone

Page 20: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

20Department of Information Engineering

Inheritance and implementation

USB

MP3 DigitalCamera

MobilePhone

Rest of theSystem

Interface

Implementation

Page 21: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

21Department of Information Engineering

Interface and implementation

• Interface promotes the following related design concepts– Modularity

•Divide a system into modules– Encapsulation

•Hide the complexity of module, expose only the interface

– Abstraction• Intellectual simplification, e.g. USB is an

abstraction of devices (existing or yet to be invented)

•Reduce the amount of learning– Loose coupling

• change in one module won’t affect others

Page 22: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

22Department of Information Engineering

The key to LARGE SCALE DEVELOPMENT

• Different parts are manufactured by different companies from different places in the world

• Modularity, encapsulation, abstraction, and loose coupling are boiled down to one important principle in good engineering design

– The Interface

Page 23: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

23Department of Information Engineering

Example of good interface

• World-wide web– Network level interface – HTTP protocol– Human level interface – HTML/XML

• Internet– Interfaces - TCP, IP

• Airplane, plumbing, car, . . .

Page 24: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

24Department of Information Engineering

The high input impedance / small output impedance principle in circuit design

• For circuit B, if the input impedance is high, and the output impedance is low, can change B without affecting the rest of the system

• Essential ideas are the same– Divide and conquer– With good interface, one can change a part

without affecting the rest of the system

Box A Box B Box C

Page 25: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

25Department of Information Engineering

The most important principle in (software) engineering

Separation of

Interface and

Implementation

Page 26: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

26Department of Information Engineering

Interface and implementation

Disk drive

CDROM

Printer

Digital camera

Future products . . .

USB bus

Interface versus implementation

Page 27: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

27Department of Information Engineering

• USB is an abstraction of the hardware– Design the PC system around the USB

interface, not to a particular device

• The first principle in OOP (in Gamma’s Design Pattern)

programming to an interface, not an implementation

Page 28: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

28Department of Information Engineering

Why is the use of header file in C?

Interface versus implementation

.h file

int foo(int x);

.c file

int foo(int x) { . . .}

Page 29: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

29Department of Information Engineering

The reason of using header file

• Separation of interface and implementation

Rest of the system

Can only see the header file, so that the implementationcan be changed freely

.h file

.c file

Page 30: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

30Department of Information Engineering

The advantage of the separation

• Can change the implementation (.c file) without affecting the rest of the system

Rest of the system

Can only see the header file, so that the implementationcan be changed freely

.h file

.c file A new .c file

Page 31: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

31Department of Information Engineering

The essential idea of OO

• Base class provides the interface (function) declaration

• The subclass provides the implementation• The subclass inherits the interface of the

base class

Rest of the system

Can only see the base class (interface), so that the subclass(implementation) can be changed freely

Base class (.h file)

Subclass (.c file)

Page 32: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

32Department of Information Engineering

From C, C++ to C#

• Can argue that the fundamental principle has never been changed– All adhere to the principle of the separation of

interface from implementation

• The differences– On granularity

•C – separation at sub-system level (larger scale)

•C++, C# - separation at object level (finer scale)

– C++ is complicated– C# (and Java) is better because it is simpler

Page 33: Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies.

33Department of Information Engineering

Which one is a more successful design from OO point of view?

Twins Morning Musume


Recommended