cs1110 Dr' Kaminski - PowerPoint PPT Presentation

1 / 34
About This Presentation
Title:

cs1110 Dr' Kaminski

Description:

Devices: keyboard, mouse, touchscreen, . . . camera, scanner, microphone, ... package vs. in-house programs 'SW system' = set of programs. e.g., operating system ... – PowerPoint PPT presentation

Number of Views:54
Avg rating:3.0/5.0
Slides: 35
Provided by: donnaka1
Category:

less

Transcript and Presenter's Notes

Title: cs1110 Dr' Kaminski


1
cs1110 - Dr. Kaminski
  • Introduction to
  • Computers Programming

2
To do. . .
  • Attendance
  • Class cancelled? (weather? Im sick?)
  • www.cs.wmich.edu/cs1110
  • syllabus schedule
  • help
  • link to Kaminskis cs1110 WebPage

3
CS1110 Focus (scale of 0-5)
  • Programming (any language) 5
  • C language (the basics) 5
  • Debugging 4
  • Algorithm design (basic) 3
  • Follow requirement specs 3
  • Testing 2
  • Programming environment (.NET) 1
  • GUI (Visual) interface 0

4
Whats a computer?
  • PC (Windows machine), Mac, . . .
  • micro-computer (laptop, desktop, netbook),
  • mini-computer, mainframe, supercomputer
  • Blackbery, iPhone, smart phone, iPod, Tivo, Xbox,
  • print server, file server, DB server, web server,

5
2 parts of a computer
  • Hardware (HW)
  • CPU
  • Memory (RAM, )
  • Storage devices Disk, CD, DVD, thumb drive,
  • I/O devices
  • Connectivity NW, wifi, bluetooth, ethernet,
  • Software (SW)
  • programs
  • makes the computer smart
  • controls HW
  • hides most HW from user

6
HW CPU
  • 1) CU (Control Unit) - Boss
  • fetch decode instruction
  • (the instr. specified in PC (program counter)
    )
  • call pass data to/from other HW units
  • 2) ALU (Arithmetic Logic Unit) - Worker
  • arithmetic - /
  • comparisons lt

7
HW - Storage
  • 1 - Primary storage Memory (RAM)
  • internal storage
  • temporary, volatile, small, fast-access
  • e.g., 512MB, . . . 1GB, . . .
  • 2 - Secondary storage
  • disk, CD, DVD, SD card, USB thumb drive
  • external storage
  • permanent, large capacity, slow-access
  • e.g., 250GB, . . . 1TB, . . . HD
  • (or 2GB flash drive in netbook) . . .

8
HW I/O
  • Input
  • Devices keyboard, mouse, touchscreen, . .
    .
  • camera, scanner, microphone, . . .
  • File, DB, internet, . . .
  • Output
  • Devices Screen, printer, AV device, . . .
  • Control machine, robot, . . .
  • File, DB, internet, . . .

9
SW (programs)
  • system SW
  • OS, utilities, device drivers, compilers, text
    editors, NW SW, . . .
  • application SW
  • general-purpose
  • DBMS, MS Office, browser, Visual Studio
  • application-specific
  • Payroll, WMU registration

10
Programmer
  • Application programmer
  • Systems
  • Database
  • Network
  • Web
  • . . .
  • . . .
  • Games, AI, graphics, . . .

11
Program
  • recipe
  • detailed step-by-step INSTRUCTIONS
  • tells computer EXACTLY what to do
  • controls HW
  • processes data
  • package vs. in-house programs
  • SW system set of programs
  • e.g., operating system

12
Software Engineer
  • Programmer - Developer
  • Systems Analyst - Designer
  • SW Engineering activities
  • Plan, design, test, document
  • Code ( write program)
  • Develop GUI
  • Develop modules (classes)
  • Customize package
  • Build SW from components
  • . . .

13
IPO model (IPSO model?)
  • Input ? Processing ? Output
  • Storing

14
IPO
  • HUMAN
  • see/hear ?think remember ? speak/write
  • HW
  • mouse/KB ? CPU RAM disk ? screen,
  • SW (traditional program)
  • data ? process store ? data
  • (user/file/DB) (user/file/DB)
  • the PROGRAM

15
Data
  • text, numbers
  • graphics, sound, images, movies, . . .
  • mouse clicks (single/double, left/right), mouse
    hovers, . . .
  • web page, text message, . . .

16
Types of applications
  • Batch processing
  • Typically file in, file/printer out
  • Interactive
  • simple text I/O with user (Console App)
  • GUI (Windows App)
  • (Web App)
  • Visual C can do all of these
  • CS1110 only Console Applications

17
IPO
  • SW (windows application)
  • user input ? process store ? screen
    display
  • mouse clicks ? ? DB
  • data in a form ?
  • SW module (a method)
  • input parameter ?procedure ? return value
  • local variables
  • classs instance variables

18
Types of Programs/Programming
  • Event-driven program
  • Modular program
  • Visual program
  • Structured program
  • Procedural program (next time )
  • Object-oriented program (couple weeks)
  • OOP
  • Visual C can do all of these

19
Event-driven programming
  • IPO event ? handler module
  • in program ? effects
  • Events
  • left-mouse-click on button/slider bar/menu item,
  • mouse hovers over X,
  • user hits Enter key, hit F5 key,
  • sensor detects change,
  • change made to the DB,
  • . . .
  • Programming Write a module to handle any event
    that could happen

20
Windows App vs. Console App
  • event-driven
  • Windows App vs. Console App
  • Controller User Program (Main)
  • Input PUSHed into PULLed by
  • program by user program
  • Interface Windows/GUI/ Console (text)
  • Visual/web/
  • Mode Interactive Batch or
  • simple text I/O

21
Modular programming
  • Program a collection of small modules
  • A module is
  • (in Procedural Prog.)
  • an IPO procedure or function
  • (in Object Oriented Prog.)
  • a Class (object)
  • a IPO method within a class
  • procedure
  • Programming write modules
  • Top-down or bottom-up

22
Visual Programming
  • Visual C, Visual Basic, Visual C, Visual J
  • 1) Construct GUI from pre-existing visual
    components
  • Text box, radio button, slider bar, dropdown
    list,...
  • 2) Adjust the properties of these objects
  • 3) Add procedural code (a module) specifying
  • WHAT to do for
  • each EVENT that might happen to this object
  • (Much code is automatically generated for an
    object)

23
Structured Programming
  • All procedural code (C methods) is made from
    stacking or nesting of
  • 1) Sequence Structure
  • action1, action2, action3, . . .
  • 2) Selection (condition) Structure
  • if conditionX is true
  • then action1
  • else
  • action2
  • 3) Repetition (loop) Structure
  • while conditionX is true do
  • action1,
  • action2,
  • ...

24
Programming
  • problem-solving ? ? solution
  • Solve the problem right AND
  • Solve the right problem
  • Determine
  • WHAT needs to be done
  • HOW to do it (the algorithm)

25
Example Problems
  • iPod - List Song titles in alphabetical
    order
  • Calculate final grade in cs1110
  • Sync up iPod iTunes on PC
  • Pay off a car loan at X over Y years
  • Google Map Directions
  • find the shortest path Kzoo ? GR

26
Steps in programming
  • Requirements specification (what)
  • Program design (how)
  • The Algorithm (in Pseudocode)
  • Which Modules
  • GUI
  • Coding (development) in C
  • Testing debugging
  • Documentation (external)
  • Maintenance

27
Algorithm (the P of IPO)
  • e.g., find all Prime Numbers lt 120?
  • View of P
  • Users view BLACK-box
  • Programmers view WHITE(clear)-box
  • (write test actual code)
  • Programs P (the processing) could
  • Lookup in a table / file / DB
  • Calculate using
  • Algorthm1 or Algorithm2 or . . .

28
Construct program from
  • pre-existing classes/methods in library
  • just need to know interface (I/O)
  • classes/methods written by programmer

29
Basic Operations (processing) used in a program
  • 1) Actual Work
  • arithmetic
  • comparison ( , lt, gt, and, or, not)
  • 2) Move/storing data
  • Assignment Mem ? Mem
  • I/O (Read)
  • KB/mouse/text-on-screen/touchscreen/file/ ? Mem
  • I/O (Write)
  • Mem ? screen/printer/file/

30
Basic Operations (processing) used in a program
  • 3) Control the flow
  • (what instruction executes next)
  • default do next line
  • maybe do this line (if, switch)
  • jump to specific line (loop, break)
  • goto return (call)
  • 4) Packaging
  • Methods (procedures)
  • Classes

31
1st 2nd Generation Programming Languages
  • Machine Languages (ML)
  • 11010010001010011110000111000111
  • Machine-dependent
  • Assembly Languages
  • Add 210(8,13)
  • Machine-dependent

32
3rd Generation Languages
  • High Level Languages (HLL), e.g., C
  • Average (Ex1 Ex2 Ex3) / 3
  • 2 main programming paradigms
  • Procedural (PP)
  • C, COBOL, Fortran, Basic, ... ,
  • any OOP can do PP
  • Object-oriented (OOP)
  • C, Java, C, Visual Basic.NET

33
Compiler
  • HLL program ? compiler ? ML program
  • Hello.cs ? C compiler ? Hello.exe
  • (source code) (executable)

34
4th 5th Generation Languages
  • Application-specific Languages
  • e.g., SQL for DBS
  • Select name, phone from student
  • where major CS and state MI
  • Natural Languages (English, . . .)
  • If patient is age 65 or older
  • and is disoriented
  • and has pain in his/her left arm
  • then patient could have had a heart attack
Write a Comment
User Comments (0)
About PowerShow.com