Download presentation
Presentation is loading. Please wait.
Published byFrederick Knight Modified over 9 years ago
1
1 Course Focus 1.Programming (any language) PP (Procedural Programming) OOP (Object-Oriented Programming) 2.Problem solving Understand the problem & requirements (I P O S) Design modular program structure Design algorithms Code Test & Debug 3.Java language (the basics) 4.IDE: NetBeans (the basics)
2
2 What’s “a computer”? Laptop, desktop Mainframe, supercomputer Tablet, smart phone, Tivo, Xbox, … Server: print server, file server, DB server, web server, …
3
3 2 parts of a computer Hardware (HW) 1.CPU 2.Memory (RAM, …) 3.Storage: Disk, CD, DVD, thumb drive, SD card,… 4.I/O devices 5.Connectivity: network, wifi, bluetooth, ethernet,… Software (SW) programs makes the computer “smart” controls HW hides most HW from user
4
4 HW – CPU 1) CU (Control Unit) - Boss fetch & decode instruction (the one specified in PC (program counter) ) call & pass data to/from other HW units 2) ALU (Arithmetic & Logic Unit) - Worker arithmetic+ - * / comparisons== != =
5
1-5 IPO (Input/Processing/Output) Instruction (input)Result (output) Arithmetic Logic Unit Control Unit CPU
6
6 HW – Storage 1 - Primary storage = Memory (RAM) internal storage temporary, volatile, small, fast-access e.g., 512MB... 4GB,... 2 - Secondary storage disk, CD, DVD, SD card, thumb drive external storage permanent, large capacity, slow-access e.g., 500GB,... 1TB,... HD (or 8GB flash drive in netbook)...
7
7 HW – Storage - RAM “Random Access Memory” contains Currently running PROGRAMS DATA used by those programs RAM divided into bytes, grouped into words Each word has a unique address
8
8 bits & bytes & words A byte = 8 bits a bit is either ON (1) or OFF (0) A word = 4 bytes (32-bit system) = 8 bytes (64-bit system) Bytes/words contain: Machine language instruction Data: 1 char (‘A’) stored in 1 byte 1 integer (2763101) stored in 4 bytes
9
9 HW – I/O Input: keyboard, mouse, touchscreen,... camera, scanner, microphone,... file, DB, internet,... Output: screen, printer, AV device,... controller for machine / robot,... file, DB, internet,...
10
10 SW (programs) system SW OS, utilities, device drivers, compilers, text editors, network SW,... application SW general-purpose DBMS, MS Office, browser application-specific Payroll, WMU registration
11
11 Programmer Applicationprogrammer Systems“ Database“ Network“ Web“ ... Games, AI, graphics,... programmer
12
12 Program recipe detailed step-by-step set of INSTRUCTIONS tells computer EXACTLY what to do controls HW processes data an algorithm to solve a problem implemented in a programming language
13
1-13 Algorithm set of well-defined steps to complete a specific task steps performed sequentially (unless…) algorithm translated to machine language algorithm written in pseudocode or flowchart or... developer implements algorithm in a high-level language (like Java) compiler produces machine language (all 0’s and 1’s)
14
14 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...
15
15 IPO model (IPSO model) Input Processing Output & Storing
16
16 IPO (IPSO) model HUMAN see/hear [think & remember] speak/write HW mouse/KB … [CPU & RAM & disk] screen, … SW (traditional program) data [process & store] data (user/file/DB) ^^^^^^^^^^ [= the PROGRAM]
17
17 Data text, numbers graphics, sound, images, movies,... mouse clicks (single/double, left/right), mouse hovers,... web page, text message,...
18
18 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) Java can do all of these CS1110 – mainly Console Applications
19
19 IPSO - SW windows application user input [process & store] screen display mouse clicks DB data in a form a SW module (a method) input parameter [procedure] return value [& local variables] [& class’s instance variables]
20
20 Types of Programs/Programming Event-driven program Modular program Visual program Structured program Procedural program (next time & …) Object-orientedprogram (couple weeks) OOP Java can do all of these
21
21 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
22
22 Windows App vs. Console App Event-driven Windows appConsole app Input:PUSHed into program program by user PULLed into program by program Controller:userprogram (main) Interface:windows/GUI/ visual/web/... console (text) Mode:interactivebatch or simple text I/O
23
23 Modular programming Program = a collection of small modules A module is: (in Procedural Programming) an IPSO procedure or function (in Object Oriented Programming) a Class (object) a IPSO method within a class ~ procedure Programming – write modules Top-down or bottom-up
24
24 Visual Programming Visual C#, Visual Basic, Java with library of classes 1) Construct GUI from pre-existing components Text box, radio button, slider bar, dropdown list,... 2) Adjust 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)
25
25 Structured Programming All procedural code (Java 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,... }
26
Procedural Programming (PP) Older languages were procedural A procedure = a set of language statements which do a specific task Program is mainly a set of procedures Procedures operate on program’s data typically operate on data items separate from procedure itself data commonly passed from one procedure to another
27
1-27 PP Data tends to be global (available) to entire program & all procedures data being passed to/from (between) procedures DISADVANTAGE: If data formats change then procedures that operate on that datamust be changed
28
1-28 Object-Oriented Programming (OOP) OOP focus: create objects (vs. procedures) Objects are combo of 1.Data – the attributes of the object 2.Procedures that manipulate that data - methods (behaviors, local procedures, services)
29
1-29 OOP Encapsulation - combine data & behavior Data hiding = object X’s data not visible to other objects in program Only object X’s methods can directly manipulate object X’s data Other objects can only access/manipulate object X’s attributes via object X’s methods
30
30 Programming = problem-solving solution 1)Solve the problem right AND 2)Solve the right problem Determine: WHAT needs to be done HOW to do it(the algorithm)
31
31 Example Problems iPhone app List Song titles in alpha order on iPod Calculate final grade in CS1110 Candy Pay off a car loan at X% over Y years Google Maps – find shortest route KZoo NY
32
32 Steps in programming 1.Requirements specification(what) input, processing, output 2.Program design(how) algorithm, modules, GUI 3.Coding (development) [in Java] 4.Testing & debugging compilation & logic & runtime errors validate results 5.Documentation (external) 6.Maintenance
33
33 Algorithm (the “P” of IPSO) EXAMPLE: find sum of 1 st 100 integers User’s view: BLACK-box Programmer’s view WHITE(“clear”)-box (write & test actual code) Program’s processing could: Look it up in a table / file / DB Crowdsource the microtask on the web Calculate it using Algorthm1 or Algorithm2 or...
34
34 Construct program from pre-existing classes/methods in library just need to know interface (I/O) classes/methods written by programmer
35
35 Basic Operations (processing) used in a program 1) Actual Work arithmetic comparison( =,, and, or, not) 2) Move/store data AssignmentMem Mem I/O (Read) KB/mouse/text-on-screen/touchscreen/file/… Mem I/O (Write) Mem screen/printer/file/…
36
36 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
37
37 1 st & 2 nd Generation Programming Languages Machine Languages (ML) 11010010001010011110000111000111 1940’s programmers wrote in ML Machine-dependent - each CPU has its own ML (Mac vs. PC) Assembly Languages Add 210(8,13) Machine-dependent
38
38 3 rd Generation Languages High Level Languages (HLL) Java, C, C#, C++, Python, Ruby, PHP, Visual BASIC, COBOL, Javascript Not processor-dependent average = (ex1 + ex2 + ex3) / 3;
39
39 3 rd Generation Languages 2 main programming paradigms Procedural (PP) C, COBOL, Fortran, Basic,..., any OOP language can do PP Object-oriented (OOP) Java, C#, C++, Visual Basic Revised versions of COBOL
40
40 4 th & 5 th 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.