Download presentation
Presentation is loading. Please wait.
Published byDarlene May Modified over 9 years ago
1
Programs/Algorithms
2
Computer Architecture What is a computer program? Flow chart Data states Data Variables History – Why VB? Procedural programming Object oriented programming Visual programming Example: Hello world
3
Drawn in figure 1-1 Main components: CPU Main memory Secondary storage Input devices Keyboard Mouse Scanner Camera (still/video/webcam)
4
Main components (contd): Output devices Monitor Printer Software Operating System Application Programs
5
Set of tasks/instructions Related? How? Set of data (states) Can be in main memory (temporary) Can be persistent Long-term Often stored in a database or data file
6
Help visualize the flow of the program. Shows mainly the instructions and decisions Is a blueprint for the logic in how to write the program Historically, different symbols used for different types of logic Variable assignment Decisions
7
Symbols: Start/End of program: Ovals Flow of control: Arrows Actions: Rectangle Input/Output: Parallelogram Conditional: Diamond
9
Variables are ESSENTIAL in programming Variables hold things Data State Variables typically have names that are meaningful Descriptive is better Older languages only allowed one letter i, j, etc… Now they can be as long as needed
10
Sometimes use underscore (_) sum_total number_of_tries “CamelCasing” Start each word with a capital letter No underscores Ex: SumTotal NumberOfTries
11
Hello World No data No states Just a control flow Gross pay calculator Data: Hours worked, hourly pay rate Ask them to exit Or exit button (control)
12
Create flowchart on board Demo of example programs
13
Procedural programming Original style Set of steps (including Input/Output) Goes from “Start” to “End” Can be shown in a flow chart easily More difficult to reuse code
14
Object-Oriented programming Current style Create “objects” that mimic real-world things Ex: Automobile Objects have properties (data) Objects have methods (actions) Car example. What are properties, methods Properties: Color, Location, Speed, Direction Actions: Honk horn, Speed up, slow down, turn to right
15
Graphical User Interface (GUI) Many, many objects have been created for visual objects Makes it easier to program Looks great Don’t have to “reinvent the wheel” Graphical environment to write programs Graphical environment to debug programs
16
GUI programming is event-driven Screen “sits there” in a loop, waiting for user action You write “event handlers” that handle each action that might be taken Button clicks Typing text Check a checkbox Only have to write a little bit of code at a time Much, much easier to debug!
17
Demonstrate graphical version of the two example programs
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.