comp4_unit5a_lecture_slides

advertisement
Introduction to Information and
Computer Science
Computer Programming
Lecture a
This material (Comp4_Unit5a) was developed by Oregon Health and Science University, funded by the Department of Health
and Human Services, Office of the National Coordinator for Health Information Technology under Award Number
IU24OC000015..
Computer Programming
Learning Objectives
• Define the purpose of programming languages. (Lecture
a)
• Differentiate between the different types of programming
languages and list commonly used ones. (Lecture a)
• Explain the compiling and interpreting process for
computer programs. (Lecture b)
• Learn basic programming concepts including variable
declarations, assignment statements, expressions,
conditional statements and loops. (Lectures c, d)
• Describe advanced programming concepts including
objects and modularity. (Lecture e)
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
2
Programming Languages
• Specify commands for a computer to perform
– Syntax
– Keywords
– Punctuation
• Create programs
• Pre-date computers
– Jacquard looms
– Player pianos
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
3
Software
• All software that runs on a computer is
a program
– Written using a programming language
– Many different languages available
• Software can be small programs or
large, complex ones
– Operating system
– Word processing program
– Simple utility
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
4
Software Development
• Creating software includes more than just writing
the computer program
• Market analysis, requirements, and design
specifications are important before starting to
write programs
• Testing is important while writing
• Support and maintenance are needed for the life
of the software
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
5
Software Development Stages
•
•
•
•
•
•
Planning/exploratory phase
Analysis/requirements gathering
Design
Implementation
Testing
Deployment and maintenance
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
6
Prototyping
• Prototypes are initial versions of program used
for feedback
– Paper
– Electronic, but not functional program
– Functional program, but limited
• Can be done during any of the initial stages of
development
• Good tool for keeping stakeholders involved
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
7
Software Development
Methodology/Frameworks
• Frameworks describe process and structure of
development
– May include prototyping
• Development teams follow one methodology for
development
• Some examples:
– Waterfall method (Royce, 1971)
– Spiral model (Boehm, 1986)
– Rapid application development (Martin, 1991)
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
8
Algorithms
• Set of steps that define how a task is performed
• The computer program implements an algorithm
• Algorithm development occurred long before
computers!
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
9
Algorithm Example #1
• Making a peanut butter and jelly sandwich
– Get the ingredients and tools
– Spread peanut butter on one slice
– Spread jelly on other slice
– Place two slices together
(Evan-Amos, 2010, PD-US)
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
10
Algorithm Example #2
Making a peanut butter and jelly sandwich
– Get the ingredients and tools
• Two slices of bread
• Peanut butter
• Jelly
• Knife
– Spread peanut butter on one slice
(Evan-Amos, 2010, PD-US)
• Dip knife into peanut butter
• Remove knife, bringing peanut butter with it
• Place knife peanut butter side down on bread
• Swirl knife to spread peanut butter
– Spread jelly on other slice
– Place two slices together
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
11
Algorithm Uses
• Describes problem solution without the
programming syntax
– Pseudocode
– Flowcharts
• Plan solution BEFORE programming
• Can determine/prove
– Correctness
– Time
– Storage
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
12
Coding
• Programs/programming statements are also
called code
• Writing programs is called coding
• Choices for programming languages:
– Functionality of program
– Where it will run
– What is available
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
13
Categories of Programming
Languages
Low-level languages:
•
•
First Generation
– Machine code (1s and 0s)
Second Generation
– Assembly language
– Words describe commands
High-level languages:
•
•
•
Third Generation
– FORTRAN, BASIC, C, Java
– Adds symbols to commands
Fourth Generation
– SQL
– Powerful, complex commands
Fifth Generation
– Prolog, visual programming
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
14
First-Generation
Machine Code
• Each computer has an instruction set
– Set of tasks computer can do
– Unique sequence of 0s and 1s
• Applications are groups of instructions
• Programmers used to program in 0s and 1s
– Switches
– Punched cards
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
15
Second-Generation
Assembly Language
• Use words to
represent instructions
• Translate assembly
code into machine
code
• Unique to each
computer, just as
machine code is
specific to each
computer
Health IT Workforce Curriculum
Version 3.0/Spring 2012
.MODEL Small
.STACK 100h
.DATA
db msg 'Hello,
world!$'
.CODE
start:
mov ah, 09h
lea dx, msg ; or mov
dx, offset msg
int 21h
mov ax,4C00h
int 21h
end start
Introduction to Information and Computer Science
Computer Programming
Lecture a
16
Third-Generation Languages
• The next generation of languages added
operations
– No longer unique to computer
– Programs more portable
• Modern programming languages are third
generation
– FORTRAN, COBOL, C, C++, C#, Java,
VB.Net
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
17
Programming Paradigms
• Procedural
– BASIC, COBOL, FORTRAN, C
• Functional
– LISP, Scheme
• Object-oriented languages
– C++, C#, Java, Ruby
• Others
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
18
Scripting Languages
• Languages that control other applications
– Batch control—shell scripts
– Web browsers—javascript
– Text processing—Perl
• Some have evolved for general application
development
– Perl, Python
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
19
Some Languages Specifically
Designated for Health Care
• MUMPS (Massachusetts General Hospital Utility Multi-Programming
System; Neil Pappalardo first developed in 1960s, standardized in 1977)
• MIIS (Proprietary implementation of MUMPS, 1969)
• MAGIC (MEDITECH Corp – founder N. Pappalardo, 1982)
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
20
Computer Programming
Summary – Lecture a
• Programming languages specify commands for
programs to run
• Software is developed using a methodology
• Algorithms are sequences of tasks
• Programming languages may be high level or
low level
• Programming languages have been developed
for healthcare
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
21
Computer Programming
References – Lecture a
References
•
Boehm B, (1986). "A Spiral Model of Software Development and Enhancement", ACM SIGSOFT Software
Engineering Notes, 11(4):14-24.
•
Meditech Magic Platform. [Webpage]. c 2007. [updated 2007 Jan 18; cited 2011 Nov 13]. Available from:
http://www.meditech.com/PublicRelations/pages/technologyMAGICOS.htm.
•
MIIS. (2011). Retrieved 2011 Nov 13 from Wikipedia:
http://en.wikipedia.org/wiki/MIIS_%28programming_language%29.
•
Morley Deborah, Parker Charles S. (2010). Chapter 13: Program Development and Programming Languages. In:
Understanding Computers Today and Tomorrow.12th ed. Boston: Course Technology.
•
MUMPS. (2011). Retrieved 2011 Mar 1 from Wikipedia : http://en.wikipedia.org/wiki/MUMPS.
•
Parsons JJ, Oja D. (2010). Chapter 12: Computer Programming. In: New Perspectives on Computer Concepts
2011: Comprehensive. 13th ed. Boston: Course Technology.
•
Programming Languages. (2011). Retrieved 2011 March 17 from Wikipedia:
http://en.wikipedia.org/wiki/Programming_languages.
•
Programming Paradigms. (2011). Retrieved 2011 Mar 14 from Wikipedia:
http://en.wikipedia.org/wiki/Programming_paradigms.
•
Rapid Application Development. (2011). Retrieved 2011 Nov 13 from Wikipedia:
•
http://en.wikipedia.org/wiki/Rapid_application_development.
•
Scripting Languages. (2011). Retrieved 2011 Mar 11 from Wikipedia :
http://en.wikipedia.org/wiki/Scripting_languages.
•
Software Development Methodology. (2011). Retrieved 2011 Nov 13 from Wikipedia:
http://en.wikipedia.org/wiki/Software_development_methodology.
•
Waterfall Model. (2011). Retrieved 2011 Nov 13 from Wikipedia: http://en.wikipedia.org/wiki/Waterfall_model.
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
22
Computer Programming
References – Lecture a
Images
Slide 10, 11: Peanut Butter and Jelly Sandwich Image [image on the Internet]. Evan-Amos. (2010, November 11).
http://en.wikipedia.org/wiki/File:Peanut-Butter-Jelly-Sandwich.jpg. Retrieved January 2012, from Wikipedia
website: http://en.wikipedia.org. (PD-US).
Health IT Workforce Curriculum
Version 3.0/Spring 2012
Introduction to Information and Computer Science
Computer Programming
Lecture a
23
Download