Download presentation
Presentation is loading. Please wait.
1
1 CS 106, Winter 2009 Class 4, Section 4 Slides by: Dr. Cynthia A. Brown, cbrown@cs.pdx.educbrown@cs.pdx.edu Instructor section 4: Dr. Herbert G. Mayer, herb@cs.pdx.eduherb@cs.pdx.edu
2
2 Analysis -> Design Determining what a process should do is called analysis or requirements gathering. We begin by describing the interface (perhaps with a picture), and writing our use cases and tests We determine what our objects and events are, and what internal state the process needs to keep track of. At that point we are ready to design our process using flowcharts.
3
3 Flowchart process Start with a list of objects and their events, along with the internal state you need to keep track of. Be flexible… you may discover the need for more events or state variables as you design the process Make a flowchart for each event Using the flowcharts, walk through the use case tests and make sure everything works properly
4
4 Flowchart Symbols Flowline: Connects symbols and indicates the flow of logic. Input/Output: Data to be read or displayed are described inside. Terminal: Represents the beginning or end of a task. Processing: The process description is included inside the symbol. Decision: Used for logic/comparison operations. Has one entry and two exits.
5
5 One more… Continuation
6
6 Money Input Slot: Version 2 User Inserts Coin end Nickel? MonEnt<- MonEnt +.05 Dime? MonEnt<- MonEnt +.10 Quarter? MonEnt<- MonEnt +.25 yesno yes end no yes end no Return coin end
7
7 Selection Button A Event Flowchart
8
8 Your Assignment For the parking meter, list the objects and their events, and create variables for the internal state. Choose 4 non-trivial events, and create flowcharts for them. Due next Thursday, Oct. 16.
9
9 The Next Step First we gather requirements and organize them in use cases, with tests. This is the look and see phase. Then we design a process that will do what the requirements specify. This is the imagine step. Finally we implement our design in a program, machine, manual, etc. This is the show step. We can then test it to see if we have accurately implemented the requirements.
10
10 Specification -> Implementation We will learn how to implement a process on a computer, using Visual Basic The great thing about this is that we can play with it and test it to make sure it meets our specifications and passes all our tests Implementing a process for the computer also forces us to be extremely clear and thorough
11
11 A Little About Computers A computer consists of hardware: the physical machine. The hardware is not useful until we install software: the programs that make the computer do what we want.
12
12 CPU (where processing takes place) can: compare 2 numbers add/subtract/mult./divide 2 numbers copy/load number from memory to CPU store a number from CPU to memory … Central Processing Unit (CPU) Memory Memory (simply): Holds numbers/text/music/pictures/video, all in digital form. Input/Output/Storage devices: Hold numbers/text/music/pictures/video Display numbers/text/music/pictures/video Allow numbers/text/music/pictures/video to be input Data must move from external storage (e.g., disks) into memory. The CPU can’t see the data until it is inside the CPU. A Simplified View of Hardware
13
13 Software: Operating System The most basic software on your computer is the operating system Common operating systems are Windows (various flavors), Linux (again available in many versions), and Mac OS (ditto). Windows and Mac OS are proprietary. Linux is open source, and some versions are free.
14
14 Operating System The operating system runs your computer and orchestrates the rest of the software It makes sure, for example, that the information that a key has been pressed gets sent to the right piece of software It makes sure that information gets sent to and retrieved from external devices as needed It keeps all the windows organized It controls access to your files
15
15 Application Programs An application is a program you use to complete some task Examples include web browsers, word processors, games Using an application makes you a software user
16
16 Software Developer All the programs that run on your computer, including the operating system and the application programs, were written by someone (often by a big team of people) called software developers They were written using a programming language such as Visual Basic (other examples include Java, Perl, C++)
17
17 Computer Programs Programs contain instructions for the computer that tell it how to perform some process Actual computer instructions at the hardware level are digital like everything else, and stored in memory just like data. In fact the ability to store a program distinguishes a computer from other sophisticated machines
18
18 Writing a Program Programmers usually write in “high level” languages You write using an editor and other tools, possibly a programming environment. Just as with a word processor, which helps you write documents, the programming environment helps you write programs
19
19 A Program is a Special Kind of Document A program is a document (or set of documents) that contains instructions for the computer Running a program makes the computer do something There are two ways to run a program: interpreted and compiled
20
20 Compiled Programs A compiler translates a program into a form that the operating system can run on a computer. Once a program is compiled, it is independent of the source code and the development environment On Windows,.exe files are compiled programs
21
21 Interpreted Programs When an application program is interpreted, an interpreter (which is also a program) reads the application program line by line and interacts with the operating system to run the program The interpreter uses the source code In the development environment, using the interpreter lets us look at what the program is doing internally while it is running
22
22 VB Can Do Both Interpretation is great while we are developing the program since it lets us examine what is going on After the program is finished, we can compile it to get something that runs faster and is independent of the source code and the development environment
23
23 VB Projects A VB project is more than just a single file of code VB has many great features that assist us in easily creating nice user interfaces that interact well with the Windows environment It automatically creates components that the operating system will need to run the program properly
24
24 Controls Controls are what VB calls the objects that can appear in the user interface Chapter 2.2 has a nice tutorial on the most common controls – Text box – Button – Label – List box We’ll walk through an intro to these after the break
25
25 BREAK 10 min
26
26 DEMONSTRATION Getting started with Visual Basic
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.