+ All Categories
Home > Documents > ITP 101 Intro to IT Programming - University of Southern...

ITP 101 Intro to IT Programming - University of Southern...

Date post: 30-Apr-2018
Category:
Upload: nguyenthien
View: 216 times
Download: 1 times
Share this document with a friend
33
ITP 101 Intro to IT Programming
Transcript
Page 1: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

ITP 101 Intro to IT Programming

Page 2: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Overview • Programming lifecycle • Program design • Testing and debugging

2

Page 3: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Facebook?

3

Page 4: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Why Learn Programming? • Intellectually challenging • Careers in programming

– Entry level programmer averages $54,139 – Senior software engineer averages $115,931 – Salary data from Salary.com

• Manage projects that involve software – Interface with other programmers – Also know the capabilities and limitations – Understand the lingo

• Program for mobile devices

4

Page 5: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

What is a program? • A series of step by step instructions for

solving a problem – Normally, this problem must be well defined – Problem must be easily broken down into

individual tasks

5

Page 6: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Programming • Also known as the software development

life cycle • Six steps

1. Specification 2. Design 3. Code 4. Test 5. Documentation 6. Maintenance

6

Page 7: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

1. Program Specification • Define the objectives

– The problem you are trying to solve! – The more specific, the better

• Define the input and output – Typically, this is the end user definition, not

the programmer • State the requirements for processing

– Any particular prerequisite steps • Document!

7

Page 8: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

2. Program Design • Plan a solution • Programming techniques

– Top down design • Take the problem, and continuously break it down into smaller chunks

until it cannot be broken down any more – Pseudocode

• Write the code in plain English before writing in computer code – Flowcharts

• Used to represent the flow of the program from the programmer’s perspective

• Logic structures are used here (for program branching)

• In reality, every large program uses a combination of these and other techniques. They are not mutually exclusive.

8

Page 9: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Software Engineering • UML – Unified Modeling Language

– A language for modeling software systems – A blueprint for software – Used for all aspects

of design of software – Managers should

know and understand UML

9

Page 10: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

3. Programming • Actually writing the code • Elements to a good program

– Reliable – Structured – Uses the most appropriate language – Secure – can handle bad data

10

Page 11: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Geek Joke

11

Page 12: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Coding • Programming language

– Language that expresses computations that can be performed by a computer

• A computer program is – “A set of coded instructions that enables a machine,

especially a computer, to perform a desired sequence of operations.” – American Heritage Dictionary

• Programming instructions are written using a “programming language” – Examples: C/C++, Java, Python, Objective-C, BASIC – LOTS of programming languages – Different uses for different languages

12

Page 13: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Example Java Code

13

MyStory.java

Page 14: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

4. Testing

• Debugging – Testing and eliminating errors

– Syntax error – language violation

– Logic error – problem with the design of the program

• Testing – Use sample data

14

Page 15: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Software Release Cycle • Pre-Alpha

– Initial development – Tested while functionality is developed

• Alpha – Most of the functionality is there – Sent to internal testing for functionality

• Beta – Public phase testing – Used for the public to give feedback to developers – Functionality may still be implemented and changed

• Release Candidate – All functionality is present – Last phase of testing for public

• Release – Sent to public as a “finished” product

15

Page 16: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

5. Documentation • Actually done throughout the entire

process • Documentation for users, operators, and

programmers – Writing end-user documentation is the hardest

part • Programmers should never write this

16

Page 17: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

6. Maintenance • > 75% of cost is devoted to maintenance • User’s needs change over time • Program may not be written to accommodate future

changes in programming – Example: multi-core processing

• Operational Maintenance

17

Page 18: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Software to Write Software • Software tools for aiding programmers to

write source code • All programming can be done with Notepad! • Most development is done using an

Integrated Development Environment (IDE) – Microsoft Visual Studio –

used on PCs for C, C++, C# – Eclipse – used for Java, Android, … – Xcode – used on Macs for Objective-C

(iPhone, iPad)

18

Page 19: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Procedural vs. OO Programming • Procedural Programming

– Step-by-step approach to solving a problem – Used extensively until the development of object-

oriented programming • Object-Oriented Programming (OOP)

– Program is organized into discrete units called objects

– Objects contain the data and the processing instructions

– Allows for code to be reused easily, – Programming can be broken down into portions

to be independently developed

19

Page 20: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Programming Languages • Low-level languages

– Machine language – bunch of 1’s and 0’s – Assembly Language – language to directly

manipulate hardware • High-level languages

– C, C++, C#, Java, Objective-C – Compiler – directly translates an entire high-level

language into another language (high level or low level)

– Interpreter – translates the language in real time • Examples – Python

– Query Languages – SQL being the most common – Scripting Languages – Javascript, Perl, etc.

20

Page 21: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Top 20 Languages by Book Sales

http://readwrite.com/2012/04/10/java-leads-programming-languag

21

Page 23: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Complied Programs

23

Examples:

C, C++, Objective-C

Page 24: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Compiling Code

24

Page 25: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Interpreted Programs

25

Example:

Page 26: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Python • Great first programming language • Runs on Windows, Linux/Unix, Mac OS X, and has been

ported to the Java and .NET virtual machines • Free to use, even for commercial products, because of

its OSI-approved open source license • Named after Monty Python

26

Page 27: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Sequencing – Making a PB&J • Put the following steps into order

27

Dip the knife into the jelly and spread onto one slice of bread. Eat and enjoy! Dip the knife into the peanut butter and spread onto one slice of bread. Cut the sandwich in half. Get out 2 slices of bread, peanut butter, jelly and a knife. Put the pieces of bread together. Open the jars of peanut butter and jelly.

Page 28: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

PB&J • Steps in order

28

1. Get out 2 slices of bread, peanut butter, jelly and a knife.

2. Open the jars of peanut butter and jelly. 3. Dip the knife into the peanut butter and

spread onto one slice of bread. 4. Dip the knife into the jelly and spread onto

one slice of bread. 5. Put the slices of bread together. 6. Cut the sandwich in half. 7. Eat and enjoy.

Page 29: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Hello World • In a file named HelloWorld.py

29

print 'Hello World'

Page 30: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Java uses a Compiler and Interpreter

30

Page 31: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Large-scale Development • Need to have a way to manage the source

code • SCM – Source Code Management

– Most popular is SVN – Subversion – Programmers check-in and check-out code – As you check-in code that you’ve

worked on, the server (SVN) process the changes and integrate them into the rest of the project

31

Page 32: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Careers in IT • Programmer / Software Engineer

– Create programs – Bachelors in CS, or equivalent experience – Average salary is $72,000 – Also work on a contractual basis

• Quality Assurance (QA) / Tester – Write and run test procedures – Average salary is $66,000

• Quality Assurance Manager – Average salary is $90,000

32

Page 33: ITP 101 Intro to IT Programming - University of Southern ...trinagre/itp101/lectures/ITP101_Programming.pdf · ITP 101 Intro to IT Programming . Overview • Programming lifecycle

Programmer Salaries

33


Recommended