280 likes | 304 Views
In this course, you will learn the basics of computer programming and how a computer works. No previous programming experience is required. You will make several programs and additions to existing products. Attitude is key!
E N D
Computer Programming for Everyone Petri Kuittinen Lead Game Designer Riot Entertainment Ltd.
Introduction • 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
Agenda I • Introduction 9:30-9:32 • How a Computer Works 9:32-9:38 • What is Programming 9:38-9:45 • (Monty) Python 9:45-9:50 • Basics of Python 9:50-10:25 • Revision 10:25:-10:30 • 15 Minute Break
Agenda II • Let’s See Some Games 11:00-11:10 • Modify the Products 11:10-11:45 • Check & Revision 11:45-11:55 • Tips for Future 11:55-12:00 After that you will know more than most IT consultants ever know
Computer Organization INPUT/OUTPUT PERIPHERALS CPU BUS MEMORY
Compilation Source Code Compiler Compilation Time Executable Binary Output Run Time Input
Interpretation Source Code Interpreter Output Input
From C to Machine Language int sum_of_squares(int a, int b) { return a*a+b*b; } 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: 00x8be58955 4 0xaf0f0855 8 0x0c458bd2 12 0x01c0af0f 16 0x90c3c9d0
(Monty) Python • very high-level programming language • highly modular • object-oriented • automatic memory management • dynamic typing • interactive • very easy to learn
Hello World – Program In Java: class HelloWorld { public static void main(String[] args) { System.out.println(”Hello World!”); } } In Python: print ”Hello World!”
Python • 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
Who Uses Python? • Google • Yahoo! • Rebel Act Studios (Severance) • Industrial Light and Magic • Lawrence Livermore Labs • Digital Creations (ZOPE) • Redhat (Linux)
Software 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
Program 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
Programming 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)
Relational Databases (SQL) Table MEMBERS SELECT * FROM MEMBERS WHERE LastName=”Cleese”;
Object-Oriented Modeling Animal Super Class Inheritance Classes Mammal Instance King Arthur Age: 34 Residence: England Cat Human
IDLE • Alt+n next (in command history) • Alt+p previous (in command history) • Cltr+a go to beginning of line • Ctrl+c interrupt program • Ctrl+e go to end of line • Ctrl+k yank (delete) to the end of line • Ctrl+s save • Ctrl+F5 run script • Ctrl-z undo
Summary • Python built-in data types: • numeric types: integer 1, long integer 987654321L, floating point number 3.14, complex number 2+3j • sequence types: strings ””, list [”cat”, 3], tuple (1,2), xrange • mapping type: dictionary {key:value} • other: module, class, class instance, function, method, file object
Summary II • expressions: • arithmethic operators: + - * / ** % • statements: • if ...: ... elif ...: ... else: • while ...: ... • for ... in ...: • import • return
Summary III (Objects) • classClassName(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!
Where 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: news:comp.lang.python • And of course Python’s built-in documentation!
Recommended Books • Harms; McDonald: The Quick Python Book (Manning Publications 2000) • Lutz; Archer: Learning Python (O’Reilly 1999) • Chun, Wesley J.: Core Python Programming (Prentice Hall 2000) • Beazley, David: Python Essential Reference (New Riders 1999) • Lutz, Mark: Programming Python (2nd Edition) (O’Reilly 2001) • Grayson, John E.: Python and Tkinter Programming (Manning Publications 2000)
On-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
SQL (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/
Programming Languages • Google Web directory > Programming > Languages • http://directory.google.com/Top/Computers/Programming/Languages/ • The Great Computer Language Shootout • http://www.bagley.org/~doug/shootout/ • Language Comparison and Critiques • http://www.openhere.com/tech1/programming/languages/language-comparison-and-critiques/
Language Comparisons • An empirical comparison of C, C++, Java, Perl, Python, Rexx, and Tcl for a search/string-processing program • http://wwwipd.ira.uka.de/~prechelt/Biblio/#jccpprtTR • 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
Successfull 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