Presentation is loading. Please wait.

Presentation is loading. Please wait.

Instructor: Zhe He Department of Computer Science

Similar presentations


Presentation on theme: "Instructor: Zhe He Department of Computer Science"— Presentation transcript:

1 Spring 2013 CS 103 Computer Science – Business Problems Lecture 15: Intro to Programming
Instructor: Zhe He Department of Computer Science New Jersey Institute of Technology 12/8/2018

2 What Is a Computer Program?
Computer programs Also called software Are a list of instructions Instructions are called code CPU performs the instructions Three types Operating system Utility Application Teaching tip Chapters 7 and 8 cover software in great detail.

3 Software Is Stored In Many Files
Executable files Contain the instructions for the CPU Have extensions of .exe, or .com Teaching tip Open a folder and demonstrate each file. Show what happens when you open each file type.

4 Software Is Stored In Many Files
Dynamic link libraries Partial executable file Used to support executable files Have .dll extensions

5 Software Is Stored In Many Files
Initialization files Contain configuration settings for software Have a .ini extension Modern programs use the registry

6 Software Is Stored In Many Files
Help files Contain information about the software Information is indexed and searchable Provides an online manual Have a .chm or .hlp extension Teaching tip Most Windows programs provide help by hitting the Help menu or pressing F1. This will open the Windows Help program and display the help appropriate to the application that launched the help.

7 Software Is Stored In Many Files
Batch files Used to automate tasks Hold a series of OS commands Have a .bat extension

8 Hardware/Software Interaction
Program execution Software executes at the CPU level Code to play a sound Code generates an interrupt CPU tells the sound card to play Sound card plays the file Programmer creates the code Discussion point Page 501 states “Computers are the reason people purchase computers”. This is an excellent quote. Have students list all the things that they do with computers. When done, point out that the majority of items are handled by a software application.

9 Hardware/Software Interaction
Code Statements written in a programming language Writing code can be tedious Code must be perfect Order of steps must be exact Writing code is quite exciting Problems are solved New ideas are formed

10 Writing Code

11 Hardware/Software Interaction
Machine code Recall that computers think in binary Code is translated into machine code CPU executes the machine code CPUs have a unique machine code Teaching tip Figure 13A.4 on page 502 shows an example of binary code.

12 Hardware/Software Interaction
Programming languages Simplifies the writing of code English is used to describe the binary Original code is called source code Several hundred languages exist Teaching tip It is a good idea to show a few different programming environments. In particular, show the same program (Hello World works well) in several different languages. Point out that the result is the same, but the syntax is very different.

13 Hardware/Software Interaction
Compilers and interpreters Converts source code into binary Allows code to execute Checks source code for correctness

14 Hardware/Software Interaction
Compiler Creates an executable file Contents are called object code Executable can run on its own Each language has its own compiler C++ and Java are compiled languages

15 Hardware/Software Interaction
Interpreter Runs program one line at a time More flexible than compilers Slower than compilers Always needed to execute program Visual Basic and Perl are interpreted

16 Planning a Computer Program
Plans The steps to solve a problem Describe the expected results Programming without a plan is difficult Teaching tip Imagine driving from New York City to Los Angeles without a map, directions, cell phone or street signs. This is programming without a plan.

17 Planning Tools Pseudo code
Natural language statements that resemble code Describes what must be done Can be written by non programmers Programmers develop unique versions

18 Compare two values and output the bigger one
12/8/2018

19 Order three number (increasing)
12/8/2018

20 Planning Tools Input-processing-output (IPO) charts
Determines what is needed Input column Data inputted by the user Processing column Pseudo code describing the problem solution Output column Desired output from the program

21 IPO Chart

22 How Programs Solve Problems
Program control flow Order program statements are executed Typically executed in order Constructs can change the flow Decision statements Loops Teaching tip Briefly describe a loop and an if statement here.

23 How Programs Solve Problems
Algorithm Set of steps Always leads to a solution Steps are always the same Flowcharts can describe algorithms Structured tool for drawing algorithms Algorithms appear in all programs Teaching tip Figure 13A.8 on page 505 shows a flowchart.

24 Flowchart

25 How Programs Solve Problems
Heuristic Set of steps Solution is usually found Solution may not be optimal Used when algorithms fail Algorithm is nonexistent or too complex Appear in more complex applications Data mining Anti-virus software Teaching tip Data mining was introduced in chapter 11B.

26 Structured Programming
Programming using defined structures Creates easy to read code Programs are efficient and run fast Several defined structures Teaching tip While lecturing, have a sample program open that incorporates all of the followings structures.

27 Structured Programming
Sequence structure Describes the flow of the program Typically executed in order Branching statements allow multiple flows

28 Structured Programming
Selection statement Also called conditional statement Performs a true or false test Determines which code to execute next Teaching tip Driving a car provides several examples of selection statements. The selection statements for an intersection with a traffic light provide three statements for discussion.

29 Structured Programming
Repetition statements Also called looping structures Repeats a section of code Until an exit condition is reached Teaching tip Discuss the algorithm for walking up a flight of stairs. It becomes apparent that a loop is needed in the algorithm. The loop exits at the top of the stairs.

30 Object Oriented Programming
Also known as OOP Enhances structured programming Intuitive method of programming

31 Object Oriented Programming
Code reuse Code used in many projects Speeds up program development Simplifies program development

32 Object Oriented Programming
Develops objects All real world items are objects OOP develops code versions Contains data about the item Contains functionality Object encapsulates both into one package Teaching tip Provide an example of an object. I often use a lead pencil. Data includes the size and type of lead. Functionality includes write, erase, extendLead, extractLead and replenishLeadSupply.

33 Programming Languages
Used to generate source code Avoids using machine code Have strict rules of syntax Symbols and punctuation have meaning Spelling must be exact Code is converted into machine language Insider information Older languages such as COBOL and Fortran actually required developers to place different coding statements in different columns on the screen.

34 Language Categories First generation language Machine languages
Written in binary Different for every CPU

35 Language Categories Second generation languages Assembly languages
Statements that represent machine code Code converted by an assembler Still used to optimize video games

36 Language Categories Third generation languages (3GL)
First higher level language Supports structured and OOP Code is reusable Code is portable Typically written in an IDE C/C++ creates games and applications Java creates web applets ActiveX creates Web and Windows applets

37 Language Categories Fourth generation languages (4GL)
Easier to use than 3GL Coded in a visual IDE Tools reduce the amount of code Object oriented programming Microsoft .Net is a language Dream Weaver is an 4GL IDE

38 Microsoft.NET

39 Language Categories Fifth generation language (5GL) Mystery language
May not be created yet Will create software automatically

40 WWW Development Languages
Markup languages Describe how the text is formatted Hyper Text Markup Language (HTML) Basis of all web pages Defines web structure using tags Easy to learn and use Created with a text editor

41 WWW Development Languages
Extensible Markup Language (XML) Stores data in a readable format Looks like HTML Allows developers to create tags Depends on HTML for formatting

42 XML

43 WWW Development Languages
Extensible HTML (XHTML) Newer version of HTML Stricter rules Based on XML rules Teaching tip Be sure to emphasize that all web technologies at some point need HTML or XHTML to present data in a browser.

44 WWW Development Languages
Extensible Style Sheet Language (XSL) Format and displays XML documents Rules that dictate formatting Create a standard web page

45 WWW Development Languages
Extensible HTML Mobile Profile XHTML MP Initially Wireless Markup Language (WML) Creates pages viewable on a handheld

46 WWW Development Languages
Cascading Style Sheets (CSS) Format HTML, XHTML and XSL Applies consistent formatting to all pages Teaching tip Students wishing to learn about the web technologies should visit W3schools.com offers several free tutorials covering nearly every mainstream web technology.

47 WWW Development Languages
Web authoring environments Reduces tedium for creating pages Tools that simplify web site creation Macromedia Dream weaver Simplifies large sites CSS support is exceptional Microsoft FrontPage simplifies large sites Macromedia Flash creates web animations Teaching tip For a fun example of what Flash can do, check out and watch the exploits of Strong Bad.

48 WWW Development Languages
Scripting languages Create dynamic web pages Change based on user input HTML can create static pages Page is generated as needed

49 WWW Development Languages
JavaScript Developed by Netscape Works inside of HTML Page verification and simple animation Based on Java

50 WWW Development Languages
Active Server Pages (ASP) Developed by Microsoft Based on Visual Basic Good at connecting to Microsoft databases Runs only on Microsoft servers

51 WWW Development Languages
Perl Old UNIX language Found on all Windows and Linux servers Excellent web scripting language

52 WWW Development Languages
Hypertext Pre-Processor (PHP) Especially good at connecting to MySQL Very popular language Runs on UNIX and Windows

53 Systems Development Life Cycle
SDLC Organized way to build programs Consists of five phases

54 Systems Development Life Cycle
Phase 1: Needs Analysis Users identify a need Need is clearly defined using tools

55 Systems Development Life Cycle
Phase 2: Systems design Solution to the need is defined Many tools are used Prototypes of the solution are built

56 Systems Development Life Cycle
Phase 3: Development Solution to the problem is built Programmers write the solution Technical writers document the process Solution is continually tested

57 Systems Development Life Cycle
Phase 4: Implementation The solution is installed Users are converted to the new system Trainers are important in this phase

58 Systems Development Life Cycle
Phase 5: Maintenance IT professionals monitor the product Bugs are found and fixed New features are added


Download ppt "Instructor: Zhe He Department of Computer Science"

Similar presentations


Ads by Google