Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies."— Presentation transcript:

1 Department of Information Engineering 1 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

2 Department of Information Engineering 2 Project – 30% Assignment –10% Exam – 60% Instructor:Prof. M. Chang Reference text –Design patterns by Gamma et al (Addison Wesley ) –www.wikipedia.org

3 Department of Information Engineering 3 No plagiarism –Penalties includ failing the course and receiving demerits. Read this web site –http://www.cuhk.edu.hk/policy/academichonesty//

4 Department of Information Engineering 4 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 _____________________)"

5 Department of Information Engineering 5 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

6 Department of Information Engineering 6 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

7 Department of Information Engineering 7 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?

8 Department of Information Engineering 8 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

9 Department of Information Engineering 9 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

10 Department of Information Engineering 10 疱丁解牛

11 Department of Information Engineering 11 To divide a system into meaningful parts A decomposed cow Head Body Front Leg Read Leg

12 Department of Information Engineering 12 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 – 牽一發而動全身

13 Department of Information Engineering 13 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

14 Department of Information Engineering 14 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

15 Department of Information Engineering 15 Interface – so that parts can be changed independently Head Body Front Leg Read Leg Interface

16 Department of Information Engineering 16 To replace a head New Head Body Front Leg Read Leg Interface

17 Department of Information Engineering 17 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

18 Department of Information Engineering 18 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

19 Department of Information Engineering 19 Inheritance Example –Interface USB specification (just a piece of paper, totally abstract) –Implementation MP3 player Digital camera Mobile phone

20 Department of Information Engineering 20 Inheritance and implementation USB MP3 Digital Camera Mobile Phone Rest of the System Interface Implementation

21 Department of Information Engineering 21 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

22 Department of Information Engineering 22 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

23 Department of Information Engineering 23 Example of good interface World-wide web –Network level interface – HTTP protocol –Human level interface – HTML/XML Internet –Interfaces - TCP, IP Airplane, plumbing, car,...

24 Department of Information Engineering 24 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 BBox C

25 Department of Information Engineering 25 The most important principle in (software) engineering Separation of Interface and Implementation

26 Department of Information Engineering 26 Interface and implementation Disk drive CDROM Printer Digital camera Future products... USB bus Interface versus implementation

27 Department of Information Engineering 27 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

28 Department of Information Engineering 28 Why is the use of header file in C? Interface versus implementation.h file int foo(int x);.c file int foo(int x) {... }

29 Department of Information Engineering 29 The reason of using header file Separation of interface and implementation Rest of the system Can only see the header file, so that the implementation can be changed freely.h file.c file

30 Department of Information Engineering 30 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 implementation can be changed freely.h file.c file A new.c file

31 Department of Information Engineering 31 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)

32 Department of Information Engineering 32 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

33 Department of Information Engineering 33 Which one is a more successful design from OO point of view? Twins Morning Musume


Download ppt "Department of Information Engineering 1 IEG3080 Software Engineering About this course –Object-oriented programming –C# –Design Patterns –Software Methodologies."

Similar presentations


Ads by Google