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

Post on 30-Apr-2018

216 views 1 download

transcript

ITP 101 Intro to IT Programming

Overview • Programming lifecycle • Program design • Testing and debugging

2

Facebook?

3

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

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

Programming • Also known as the software development

life cycle • Six steps

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

6

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

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

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

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

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

10

Geek Joke

11

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

Example Java Code

13

MyStory.java

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

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

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

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

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

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

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

Top 20 Languages by Book Sales

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

21

Complied Programs

23

Examples:

C, C++, Objective-C

Compiling Code

24

Interpreted Programs

25

Example:

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

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.

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.

Hello World • In a file named HelloWorld.py

29

print 'Hello World'

Java uses a Compiler and Interpreter

30

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

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

Programmer Salaries

33