Download presentation
Presentation is loading. Please wait.
Published byJohnathan Armstrong Modified over 9 years ago
1
TEACHING PROGRAMMING BY ITERATIVE DEEPENING Dr. Mark Lee | m.g.lee@cs.bham.ac.uk School of Computer Science, University of Birmingham http://www.cs.bham.ac.uk/~mgl/python/
2
Some Quotes If debugging is the process of removing software bugs, then programming must be the process of putting them in. (Edsger Dijkstra) Debugging is twice as hard as writing the code in the first place. Therefore if you write your code as cleverly as possible then by definition you will be too stupid to debug it. (Brian Kernighan) Logic is useless – when are we going to learn something useful? Like programming games. (First year CS student on my course – now departed)
3
Introduction Programming is a Craft Engineering (good or bad) The application of Computer Science In this talk I’ll give An overview of Python Reasons why it’s an ideal first language for kids (and adults) But my real message is Writing code is about 1. Recognising/Abstracting a problem 2. Designing/Recalling a solution (the algorithm) 3. Implementation (programming) 4. Debugging & improvement Programming cannot be isolated from the rest of computing
4
New Computing Curriculum 2014 Computational Thinking: Decomposition Pattern Recognition Abstraction Pattern Generalisation Algorithm Design (from Computing in the National Curriculum, CAS 2014) From the new Curriculum for KS3 Understand several key algorithms that reflect computational thinking; use logical reasoning to compare the utility of different algorithms for the same problem. “Use two or more programming languages, at least one of which is textual, to solve a variety of computational problems; make use of appropriate data structures; design and develop modular programmes that use procedures or functions.”
5
Python Created by Guido Van Rossum in 1991 General Purpose High Level Programming Language Emphasis on readability Emphasis on consistency Typically succinct compared to other languages (e.g. C, Java etc. Python 3.4.1 (May 2014) Dynamic Type system Highly extendable Typically a procedural language – but support for Object Oriented, Functional programming styles.
6
Code Snippets print (“hello world”) def shopping () : shopping_list = ['spam', "eggs", "ham"] count = 0 for item in shopping_list : print (item) count = count + 1 print ("total items is " + str(count))
7
Python in the real world http://blog.codeeval.com/codeevalblog/2014#.U0JQBedd V5A=
8
More realistically …
9
Why is Python popular? Python cannot compete with Speed of C, C++, C# (games programming) Specific technology friendliness of Javascript, VB.net, C#, Swift, Ruby on Rails etc. Scalability and portability of Java Higher Education Dominance of Java in undergraduate studies (but) Python is Fun Highly readable Quick to learn “Good enough” for most jobs Easy to debug Great community Native to Android, Raspberry PI, Linux, Apple IOS Good stepping stone to Java (Jython) & plays well with C (Cython)
10
Sorting Cards You have N cards which need to be sorted in ascending order. Write an algorithm with the following constraints: The cards start face down on the table The instructions must be for only one person. The person moving the cards can only have one card in each hand at any point (i.e. she can only look at the values of two cards at one time) The instructions can't require that the person remember the value of a card once they put it down. You can however use the space on the table however you like.
11
Abstraction Suppose you have a randomly sorted list of integers in the range 1 – 52 [5,6,52,24,1,43] And you wish to sort them in ascending order [1,2,3,4, … 52]
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.