Title: OOP Primer
1OOP Primer
- Bus 92Fall 2007
- Notes on Wang, 2006
2Learning to Program involves
- How to solve a particular problem
- How to use a particular programming language
- How to use a specific program to help you write
programs in your chosen programming language - Editor to write, edit and save your program
- Compiler to translate the program from a
high-level programming language (Basic) to a
lower level computing language (machine code) - VB Express is an integrated development
environment (IDE) that includes both an editor
and compiler
3The Hierarchy of Programming Languages
Visual Basic
C
LISP
Compile
Assembly
Machine Code 1110 0110 1111
4Programming Language Components
Statements
To form
Programs
Combine according to
Syntax
Building Blocks
Functions
Keywords
Functions
Keywords
Keywords
5Example
MsgBox
Dim Counter as IntegerCounter 1 Do While
Counter lt10 MsgBox (Counter) Counter
Counter 1 Loop
Syntax
Dim
Do
Integer
While
Loop
6Every VB Program is composed of
- A User interface
- Get data -- keyboard, mouse
- Display information -- printer, screen
- Instructions that make your program do something
useful - Manipulate and respond to data -- add two
numbers, select data from a table
7oop
- A programming model that facilitates division of
a program into smaller parts according to 3 core
ideas - Encapsulation
- Inheritance
- Polymorphism
8Encapsulation
- Objects store both data and the methods that
manipulate the data in a single location - Protects data from being changed by other parts
of the program
9Inheritance
- Code reuse by copying makes it hard to trace
location of copied code and apply edits - With inheritance, object b uses the code stored
in object a without copying the code - Code fixes/updates in object a automatically
fix/update code in object b
10Polymorphism
- Objects can inherit method names from other
objects - Inherited methods can operate according to new
code that results in different behaviors vs
method from source object
11Class/Object/oop example
Class Game Characters
12Match the core idea to the example
The Dragon object inherits the die method from
the prince object
The Dragon objects move method specifies slow
progressthrough the screen while the Prince
objects move methodspecifies quick leaps across
the screen
Changes to the Dragons move method do notaffect
the Prince objects move method
13Software Development Lifecycle (SDLC)
Project Planning, Feasibility Analysis
Systems Analysis
Systems Design
Implementation
Integration Testing
Acceptance Implementation Deployment
Maintenance
Bus 92 (overview)
Bus 110B
Bus 119A (mastery)
14Casual Use Cases
- Describe how the application will be used by a
user to achieve a specific goal - Identify the goal of the system
- List the key steps to achieve the goal
- Amazon.com example
15In Class Activity
- Describe your application to your partner(s)
- Ask questions if the description is unclear
- Be ready to describe your partners application
to the class - Build an initial use case for your application to
share in class
16HW2
- Write a use case of the main user interaction
with the application that you plan to build for
the class. Send the use case via email (not an
attachment) to 92thurs07_at_sbcglobal.net by noon on
Thursday, Sept 6, 2007 - Read Wang Chapters 1-6. Try to do the exercises
at home if you can install VB Express on your
machine - Bring your flash drive to class labeled with your
first name, last name, student ID