Title: Computer Programming for Everyone
1Computer Programming for Everyone
- Petri Kuittinen
- Lead Game Designer
- Riot Entertainment Ltd.
2Introduction
- No previous programming experience is required
- Everyone will learn to program and know the
basics of how computer works - Everyone will make several programs and make
additions to existing products - Attitude is the most important thing
3Agenda I
- Introduction 930-932
- How a Computer Works 932-938
- What is Programming 938-945
- (Monty) Python 945-950
- Basics of Python 950-1025
- Revision 1025-1030
- 15 Minute Break
4Agenda II
- Lets See Some Games 1100-1110
- Modify the Products 1110-1145
- Check Revision 1145-1155
- Tips for Future 1155-1200
- After that you will know more than most IT
consultants ever know
5Computer Organization
INPUT/OUTPUT PERIPHERALS
CPU
BUS
MEMORY
6Compilation
Source Code
Compiler
Compilation Time
Executable Binary
Run Time
Output
Input
7Interpretation
Source Code
Interpreter
Output
Input
8From C to Machine Language
- int sum_of_squares(int a, int b)
-
- return aabb
C
Assembler
sum_of_squares pushl ebp movl
esp,ebp movl 8(ebp),edx imull
edx,edx movl 12(ebp),eax
imull eax,eax addl edx,eax
leave ret
Machine Code
sum_of_squares 0 0x8be58955 4 0xaf0f0855 8
0x0c458bd2 12 0x01c0af0f 16 0x90c3c9d0
9(Monty) Python
- very high-level programming language
- highly modular
- object-oriented
- automatic memory management
- dynamic typing
- interactive
- very easy to learn
10Hello World Program
In Java
class HelloWorld public static void
main(String args) System.out.println(
Hello World!)
In Python
print Hello World!
11Python
- free, open source
- available for all major platforms, including
Windows, Mac, UNIX/Linux, Palm etc. - easily intergrated with other languages
- Jython Python implemented in Java
- lots of support (libraries, books)
- http//www.python.org
12Who Uses Python?
- Google
- Yahoo!
- Rebel Act Studios (Severance)
- Industrial Light and Magic
- Lawrence Livermore Labs
- Digital Creations (ZOPE)
- Redhat (Linux)
13Software Development
- project overall planning (what? how? budget,
schedule, resources) - specification
- build prototype
- program design (split into smaller components
modules, classes, functions) - implementation (programming)
- testing fixing bugs (debugging)
- release
- maintenance
14Program Development Cycles
Traditional Development
Python Development
Start the Application
Start the Application
Test Behavior
Test Behavior
Stop the application
Stop the application
Edit Program Code
Edit Program Code
Recompile code
Relink the executable
15Programming Paradigms
- Imperative Programming (C, Pascal, Basic)
- Functional Programming (Lisp)
- Object-Oriented Programming (OOP) (C)
- Logic Programming (Prolog)
- Concurrent programming (Ada)
- In Future
- Aspect-Oriented Programming (AOP)
- Subject-Oriented Programming (SUP)
16Relational Databases (SQL)
Table MEMBERS
ID FirstName LastName Address
001123 John Cleese Pet Shop
001124 Eric Idle London
002234 Terry Gilliam Spam
003245 Michael Palin Moon
SELECT FROM MEMBERS WHERE LastNameCleese
17Object-Oriented Modeling
Animal
Super Class
Inheritance
Mammal
Classes
Instance
King Arthur Age 34 Residence England
Human
Cat
18IDLE
- Altn next (in command history)
- Altp previous (in command history)
- Cltra go to beginning of line
- Ctrlc interrupt program
- Ctrle go to end of line
- Ctrlk yank (delete) to the end of line
- Ctrls save
- CtrlF5 run script
- Ctrl-z undo
19Summary
- Python built-in data types
- numeric types integer 1, long integer
987654321L, floating point number 3.14, complex
number 23j - sequence types strings , list cat, 3,
tuple (1,2), xrange - mapping type dictionary keyvalue
- other module, class, class instance, function,
method, file object
20Summary II
- expressions
- arithmethic operators - /
- statements
- if ... ... elif ... ... else
- while ... ...
- for ... in ...
- import
- return
21Summary III (Objects)
- class ClassName(superclass(es))
- constructor def __init__(self)
- generate instance instance ClassName()
- instance variables self.variable
- methods def method(self, ...)
- call method instance.method()
- Python instance objects are new namespaces!
22Where to Get More Information
- Python WWW site (download Python, documentation,
links) - http//www.python.org
- Vaults of Parnassus (Python resources)
- http//www.vex.net/parnassus/
- Usenet newscomp.lang.python
- And of course Pythons built-in documentation!
23Recommended Books
- Harms McDonald The Quick Python Book (Manning
Publications 2000) - Lutz Archer Learning Python (OReilly 1999)
- Chun, Wesley J. Core Python Programming
(Prentice Hall 2000) - Beazley, David Python Essential Reference (New
Riders 1999) - Lutz, Mark Programming Python (2nd Edition)
(OReilly 2001) - Grayson, John E. Python and Tkinter Programming
(Manning Publications 2000)
24On-line books
- Non-Programmers Tutorial for Python
- http//www.honors.montana.edu/jjc/easytut/easytut
/ - Learning to Program
- http//www.crosswinds.net/agauld/
- How to Think Like a Computer Scientist
- http//www.ibiblio.org/obp/thinkCS.html
- Dive into Python (for experienced programmers)
- http//www.diveintopython.org
25SQL (Structured Query Language)
- Getting Started with SQL
- http//javascriptweenie.com/articles/sql.html
- Introduction to Structured Query Language
- http//w3.one.net/jhoffman/sqltut.htm
- MySQL free, opensource SQL database
- http//www.mysql.com/
- MySQL tutorials
- http//www.devshed.com/Server_Side/MySQL/
26Programming Languages
- Google Web directory gt Programming gt Languages
- http//directory.google.com/Top/Computers/Programm
ing/Languages/ - The Great Computer Language Shootout
- http//www.bagley.org/doug/shootout/
- Language Comparison and Critiques
- http//www.openhere.com/tech1/programming/language
s/language-comparison-and-critiques/
27Language Comparisons
- An empirical comparison of C, C, Java, Perl,
Python, Rexx, and Tcl for a search/string-processi
ng program - http//wwwipd.ira.uka.de/prechelt/Biblio/jccpprt
TR - An Analysis of Two Next-Generation Languages
Java and Python - http//www.python.org/rmasse/papers/java-python96
/ - A subjective analysis of two high-level,
object-oriented languages Comparing Python to
Java - http//www.twistedmatrix.com/glyph/rant/python-vs
-java.html
28Successfull Software Projects
- Brooks, Frederick The Mythical Man-Month Essays
on Software Engineering (Addison-Wesley 1995) - Beating the Averages
- http//www.paulgraham.com/paulgraham/avg.html
- Matloff, Norman Debunking the Myth of a
Desperate Software Labor Shortage - http//heather.cs.ucdavis.edu/itaa.real.html
- Extreme Programming
- http//www.extremeprogramming.org