Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIT 590 Intro to Programming Lecture 2. Questions regarding enrollment The cap is still in effect The course will be offered again in the spring The waitlist.

Similar presentations


Presentation on theme: "CIT 590 Intro to Programming Lecture 2. Questions regarding enrollment The cap is still in effect The course will be offered again in the spring The waitlist."— Presentation transcript:

1 CIT 590 Intro to Programming Lecture 2

2 Questions regarding enrollment The cap is still in effect The course will be offered again in the spring The waitlist is closed as well If you know programming, please consider dropping the course and taking courses like Computational linguistics Software engineering If you do not want to spend a fair amount of time programming please drop the course If you can take CIS 110 (the undergrad intro to programming) they have 1 section still open If you really absolutely have to do this course, you will have to talk to Mike Felker and convince him

3 Agenda ‘import’ IDLE frustrations Abstraction Functions Testing The concept of scope

4 One big giant python file …. Python is full of modules import math from math import * the same logic can be used for your own functions areaFuncs.py and usageOfFuncs.py Importing a module within another module

5 Agenda ‘import’ IDLE frustrations Abstraction Functions Testing The concept of scope

6 Things you cannot do in IDLE Line numbers – there are some extensions that I have not tried out Do not forget the.py extension History using the up and down keys Configure idle For other complaints … http://inventwithpython.com/blog/2011/11/29/the-things-i-hate- about-idle-that-i-wish-someone-would-fix/ http://inventwithpython.com/blog/2011/11/29/the-things-i-hate- about-idle-that-i-wish-someone-would-fix/

7 Agenda ‘import’ IDLE frustrations Abstraction Functions Testing The concept of scope

8 Abstraction A good program will have layers of abstraction Sometimes you only care about the input and output and do not really want or even need to know the intrinsics math.sqrt() how is implemented Who cares! APIs (Application Programming Interfaces) https://code.google.com/p/python-twitter/

9 PennApps!!! http://2013f.pennapps.com/

10 Modular programming Software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules each module contains everything necessary to execute only one aspect of the desired functionality. You’ll also hear this referred to as top-down design and stepwise refinement

11 functions In accordance with the concept of abstraction Divide a program up into its ‘functional’ portions Testing becomes much easier Test each component really well Think about a few integration tests vowelCounter.py

12 Information hiding David Parnas first introduced the concept of information hiding around 1972. hiding "difficult design decisions or design decisions which are likely to change." Hiding information in that manner isolates clients from requiring intimate knowledge of the design to use a module, and from the effects of changing those decisions.

13 Software reuse Do not reinvent the wheel The reuse of programming code is a common technique which attempts to save time and energy by reducing redundant work. Software libaries/modules - good example of code reuse

14 Good program design Separate your program into the building blocks Write a function for each of the building blocks Simple methods of separation Separate functions for the calculations Separate function for the input Separate function for the output

15 The coke machine example Cokemachine1 and cokemachine2.py

16 Testing functions Debugging via test cases Reading code – romanNumeral.py Code reviews

17 Scoping local variables versus global variables changing the value of a global variable within a function using the global keyword

18 Summary Understanding the importance of modular programming Functions Testing a function and code walkthroughs Variable scope


Download ppt "CIT 590 Intro to Programming Lecture 2. Questions regarding enrollment The cap is still in effect The course will be offered again in the spring The waitlist."

Similar presentations


Ads by Google