Programming and Software Engineering - PowerPoint PPT Presentation

1 / 53
About This Presentation
Title:

Programming and Software Engineering

Description:

Preliminary design. Detailed design. Coding. Testing and ... software encourages a building block approach to software development, using standardized parts ... – PowerPoint PPT presentation

Number of Views:62
Avg rating:3.0/5.0
Slides: 54
Provided by: ralphb6
Category:

less

Transcript and Presenter's Notes

Title: Programming and Software Engineering


1
Programming and Software Engineering
2
Software Development
  • We can define two main classes of software
  • User-written software
  • solve a particular problem, access information,
    automate routine tasks
  • this has been a traditional approach for
    engineers
  • availability of powerful applications software
    has greatly reduced the need for users to write
    programs
  • Commercial software
  • software written for commercial distribution, or
    for the use of other people within an organization

3
Software Complexity and Software Engineering
  • Comparing simple user-written programs to
    commercial applications is like comparing a
    birdhouse to the Skydome
  • For example, software for the space shuttle
    consists of over 40 million lines of code!

4
The State of the Software Industry
  • Software is one of the most important industries
    in the world
  • Although the applications are high tech, software
    companies are still run like cottage industries
  • Software is manufactured today the same way the
    first automobiles were manufactured 100 years ago!

5
Software Manufacturing Methods
  • Each program is built from scratch by skilled
    craftspeople
  • The components must be carefully adjusted for the
    whole thing to work
  • Parts or components are not interchangeable
    between programs (or cars in 1900)
  • There are few standards

6
Critical Problems
  • Software takes too long to develop
  • Productivity is low
  • There are many bugs that are difficult to fix
  • Much effort is directed to reinventing the wheel
    (e.g., creating user interfaces)
  • Programmers must be highly skilled

7
Software Engineering
  • Designing a software system is as complex as
    designing a rocket, a large building, or a car.
  • Designing software systems requires a sound
    engineering methodology
  • Currently, most programmers are not trained or
    certified as engineers
  • Software engineering has become an important
    discipline

8
Critical Labour Shortage
  • There is a critical shortage of programmers and
    other information technology professionals
  • Very few engineering schools offer programs in
    software engineering
  • Western will have one of the first software
    engineering programs in Canada

9
Software Life Cycle
  • The software life cycle consists of several
    phases, starting with identification of a need,
    and ending only when the software is no longer in
    use
  • The software life cycle is similar to the life
    cycle of any manufactured or engineered product

10
Software Life Cycle (summary)
  • Identify and describe an application
  • Analyse the application in detail
  • Preliminary design
  • Detailed design
  • Coding
  • Testing and debugging
  • Documentation and maintenance

11
Software Life Cycle
  • Identify and describe an application
  • market and user surveys
  • brainstorming
  • conceptual design
  • Analyse the application in detail
  • identify the functional modules

12
Software Life Cycle
  • Preliminary design
  • describe the general software structure using
    flowcharts or pseudocode
  • design alternatives can be explored at this stage
  • Detailed design
  • completely specify the program logic
  • Coding
  • implement the design using a programming language
  • coding from a detailed design is like building a
    house from a blueprint

13
Software Life Cycle
  • Test and debug
  • errors can be due to syntax (ie, incorrect
    grammar), or logic
  • logic errors are very difficult to detect
  • Documentation and maintenance
  • software may remain in use for years
  • someone must continue to fix bugs, add features,
    and help users
  • the cost of maintenance can be much higher than
    the cost of development

14
Programming Languages
  • Assembly language
  • High-level languages
  • FORTRAN, C, Pascal
  • Fourth-generation languages (4GLs)
  • Very high-level languages
  • application generators
  • natural language

15
Assembly Language
  • Much software is still written in assembly
    language
  • Advantages
  • speed, compactness, efficiency
  • Disadvantages
  • not portable
  • difficult to implement and debug
  • every function must be programmed at machine
    level
  • Thousands of programs written in Intel 80x86
    assembly language will not run on any other
    processor

16
High-level Languages
  • Most software is written in high level languages
  • Fortran, Pascal, Basic and C are popular
  • C has become a de facto standard for several
    reasons
  • standards exist, so the code is portable
  • it has much of the power and flexibility of
    assembly language

17
Problems with these Languages
  • Difficult to learn and use
  • The only built-in I/O support is character-based
    read and write
  • Not suitable for occasional quick and dirty
    programming
  • Development of Graphical User Interface is
    difficult
  • Much of the code is a reinvention of the wheel

18
Fourth Generation Languages (4GLs)
  • 4GLs and Rapid Application Development (RAD)
    tools are used to develop applications with
    little or no programming
  • Typically use a graphical, drag-and-drop approach
  • Corresponding source code is generated
    automatically

19
Examples of RAD Tools
  • Microsoft Visual Basic
  • Borland Delphi
  • Powersoft PowerBuilder
  • Topspeed Clarion

20
Structured Programming
  • An important methodology for dealing with
    complexity is structured programming
  • Complex tasks need to be broken down into simpler
    subtasks
  • Structured programming reduces complex problems
    to collections of simple, interconnected modules
  • It is up to the programmer to implement
    structured programming

21
Programming for DOS
  • DOS provides few system services to the
    programmer
  • It is up to the programmer to implement the
    following modules for each application from
    scratch
  • user interface
  • printer drivers
  • video drivers
  • etc.
  • As a result, every application looks and works
    differently

22
Programming for Windows
  • Windows provides many standard services to the
    programmer
  • It also specifies a common look and feel for all
    applications
  • Now the programmer does not need to worry about
    low level drivers, GUI programming, etc.
  • The programs call Windows Application Program
    Interface (API) functions
  • Unfortunately, the programmer needs to be
    knowledgeable about hundreds of API functions

23
Graphical User Interfaces
  • In most applications, the majority of code is
    associated with the user interface
  • The Windows API provides hundreds of functions to
    create menus, dialog boxes, etc.
  • Developing the GUI is difficult

24
Procedural Vs. Interactive, Event-driven Programs
  • Traditional programs are procedural, with limited
    user interaction
  • Most Windows applications are event-driven
  • The program responds to user events, like menu
    selections, keyboard input and mouse clicks

25
Hello, World!
  • A classical C programming example simply prints
    the message Hello, world on the screen.
  • In standard C, the entire program is shown below.

include ltstdio.hgt main() printf(Hello,
world\n)
26
Hello, World!
  • The equivalent program in Windows requires two
    pages of cryptic code
  • The program creates a window, and writes Hello,
    Windows in the centre
  • This is the simplest Windows program possible
  • This example demonstrates the shift from
    text-based applications to event-driven graphical
    applications

27
Hellowin.c Page 1
/------------------------------------------------
-------- HELLOWIN.C -- Displays "Hello,
Windows" in client area (c)
Charles Petzold, 1992 --------------------------
------------------------------/ include
ltwindows.hgt long FAR PASCAL _export WndProc
(HWND, UINT, UINT, LONG) int PASCAL WinMain
(HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpszCmdParam, int nCmdShow)
static char szAppName "HelloWin"
HWND hwnd MSG msg
WNDCLASS wndclass
28
Hellowin.c Page 2
if (!hPrevInstance)
wndclass.style CS_HREDRAW CS_VREDRAW
wndclass.lpfnWndProc WndProc
wndclass.cbClsExtra 0
wndclass.cbWndExtra 0
wndclass.hInstance hInstance
wndclass.hIcon LoadIcon (NULL,
IDI_APPLICATION) wndclass.hCursor
LoadCursor (NULL, IDC_ARROW)
wndclass.hbrBackground GetStockObject
(WHITE_BRUSH) wndclass.lpszMenuName
NULL wndclass.lpszClassName
szAppName RegisterClass (wndclass)

29
Hellowin.c Page 3
hwnd CreateWindow (szAppName, //
window class name "The Hello Program",
// window caption
WS_OVERLAPPEDWINDOW, // window style
CW_USEDEFAULT, // initial x
position CW_USEDEFAULT,
// initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial
y size NULL,
// parent window handle
NULL, // window menu handle
hInstance, //
program instance handle NULL) //
creation parameters
30
Hellowin.c Page 4
ShowWindow (hwnd, nCmdShow) UpdateWindow
(hwnd) while (GetMessage (msg, NULL, 0,
0)) TranslateMessage (msg)
DispatchMessage (msg)
return msg.wParam long FAR PASCAL
_export WndProc (HWND hwnd, UINT message, UINT
wParam,
LONG lParam) HDC
hdc PAINTSTRUCT ps RECT rect
31
Hellowin.c Page 5
switch (message) case
WM_PAINT hdc BeginPaint (hwnd, ps)
GetClientRect (hwnd, rect)
DrawText (hdc, "Hello, Windows!", -1,
rect, DT_SINGLELINE DT_CENTER
DT_VCENTER) EndPaint (hwnd, ps)
return 0 case
WM_DESTROY PostQuitMessage (0)
return 0 return
DefWindowProc (hwnd, message, wParam, lParam)

32
GUI Development Tools
  • Interactive tools have appeared to allow the
    programmer to design and test the GUI graphically
  • The code is automatically generated to implement
    the GUI
  • This saves much time, especially for
    inexperienced programmers

33
Object-Oriented Programming (OOP)
  • Traditional languages treat data and procedures
    as separate entities
  • The programmer designs procedures (instructions)
    to manipulate data (variables, files, etc.)

34
Object-Oriented Programming (OOP)
  • Object-Oriented languages treat programs as a
    collection of objects
  • An object is a combination of data and procedures
    that are stored together as a reusable unit
  • Objects communicate by sending messages to each
    other

35
Object-Oriented Programming (OOP)
  • A powerful feature of OOP is inheritance
  • New objects can be based on existing objects,
    with just minor changes
  • Groups of similar objects can be grouped into
    classes

36
Object-Oriented Programming (OOP)
  • Each member or instance of a class contains
    shared code, plus code specific to the instance
  • For example, each open window in Windows is an
    instance of a class of window objects
  • Methods for opening, closing, moving, resizing,
    etc. are shared by all instances

37
Advantages of OOP
  • Generic objects can be reused in many
    applications
  • This reuse of software encourages a building
    block approach to software development, using
    standardized parts
  • Software development is much faster
  • Software is easier to understand, debug and
    maintain

38
Disadvantages of OOP
  • Difficult to learn for programmers used to
    procedural languages
  • A new way of thinking is required
  • Objects reduce portability of code

39
Object-Oriented Languages
  • The major OOP language is C
  • C is standard C with object-oriented extensions
  • Another OOP language is Smalltalk
  • A brand-new alternative is Java

40
Component Software
  • Software reuse can be accomplished using
    component software
  • Example Microsoft Component Object Model (COM)
    and ActiveX
  • Existing ActiveX components can be incorporated
    into new applications, saving much development
    time

41
Java
  • Announced by Sun Microsystems in 1995
  • Greatly hyped!
  • Seen as a way to compete with the Wintel duopoly
  • Issues have been political, as well as technical

42
The Java Promise...
  • Embedded applications like set-top boxes and
    cellular phones
  • Internet applications
  • Network computers
  • Platform-independent software development

43
What is Java?
  • A new language, similar to C but without the
    drawbacks
  • built-in garbage collection
  • no pointers
  • bounds checking
  • Object oriented from ground up
  • The language improvements eliminate many sources
    of bugs

44
Write Once, Run Anywhere
  • Java includes standard libraries for graphical
    interfaces, etc.
  • Java programs run inside a Virtual Machine (VM)
  • They are independent of processor or operating
    system

45
Applets and Network Software
  • Java can be used to write normal programs, or
    applets that run inside a Web browser
  • Applets are downloaded from a server before
    running
  • The Network Computers being promoted by Sun,
    Oracle and others will run Java

46
Java Applets
Virtual Machine
Server
Applet
Browser
47
The Hype and the Reality
  • Sun is trying to enforce 100 Pure Java that
    will run on any certified VM
  • Microsoft and others are extending and modifying
    Java
  • Visual J makes use of Windows capabilities
  • not portable
  • Microsoft, Netscape and others have developed
    their own flavours of the VM
  • The Java specification continues to change

48
The Trade-offs
  • Pure Java
  • Runs on any platform
  • Lowest common denominator
  • Limited development tools
  • Performance not optimized
  • Proprietary Java
  • May be platform-specific
  • Makes use of features of underlying operating
    system
  • Good development tools
  • Optimized performance

49
User-Oriented Languages
  • Easy to use programming applications have emerged
    to meet the need of end-user programming
  • A good example is Microsoft Visual Basic
  • Users with limited programming experience can
    quickly develop powerful, professional-looking
    applications with full graphical interfaces.

50
Macros and Application Customization
  • Many useful applications can be created by
    building on existing software
  • Word and Excel can be extensively programmed
    using Visual Basic for Applications
  • For example, you could create a program to accept
    data using an input form, analyze the results,
    and plot a graph, all in Excel

51
Computer Aided Software Engineering (CASE)
  • CASE is a set of productivity tools for
    programmers and software developers
  • The tools are analogous to wordprocessors and
    spreadsheets for business people
  • CASE is still immature, but will become
    increasingly important in the future

52
Computer Aided Software Engineering (CASE)
  • The CASE toolkit includes
  • Design tools
  • flow diagrams, structure charts, etc.
  • Prototype tools
  • user interface, screen generators, report
    generators
  • Information repository tools
  • database for the software development project

53
Computer Aided Software Engineering (CASE)
  • Program development tools
  • organize, generate and test code
  • Methodology tools
  • support standard development methodology
Write a Comment
User Comments (0)
About PowerShow.com