170 likes | 189 Views
Introduction to Programming G50PRO University of Nottingham Unit 1 : Introduction. Paul Tennent http://paultennent.wordpress.com/G50PRO.html paul.tennent@nottingham.ac.uk Room C41. Course Overview. 1 Semester 20 ish lectures plus lab sessions Assessment: Coursework one: 10%
E N D
Introduction to ProgrammingG50PROUniversity of NottinghamUnit 1 : Introduction Paul Tennent http://paultennent.wordpress.com/G50PRO.html paul.tennent@nottingham.ac.uk Room C41
Course Overview • 1 Semester • 20 ish lectures plus lab sessions • Assessment: • Coursework one: 10% • Coursework Two: 30% • Coursework Three: 60% • Course Objectives : To learn to think algorithmically and to express in sound implementations using a programming language (Scratch/Java).
Time Table • 2 lectures a week : • Wednesday: 9 am, Dearing Building, C35 • Thursday: 3pm, Business School South, A25+ • One Lab (2 hours) 5 weeks : • Wednesday: 10am, CS C11
General References • How to Think Like a Computer Scientist (Java Version) by Allen B. Downey. Available on Web: http://www.greenteapress.com/thinkapjava/thinkapjava.pdf • Getting started with Scratch http://info.scratch.mit.edu/Support • Java. How to Program by Deitel & Deitel (Prentice Hall) • Sun Java Tutorial: http://java.sun.com/docs/books/tutorial/getStarted/index.html • WWW - Google
Intro. Programming / coding • Computer programming: is the process of writing, testing, debugging/troubleshooting, and maintaining the source code of computer programs. • source code is written in a programming language. • The purpose of programming is to create a efficient and evolvable program (software) that provide a certain desired behaviour
Programming / coding • A program is a sequence of instructions • The way to deal with a difficult task is to recursively break it down into a number of less difficult tasks • The single most important skill for a computer scientist is problem-solving • problem-solving is the ability to formulate problems, think creatively about solutions, and express a solution clearly and accurately.
Programming languages • A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. • A way of communication between Humans and Computers • Many programming languages have some form of written specification of their syntax (form) and semantics (meaning) • Pascal, Java, C, C++, C#, PHP ….
Programming languages • A program must be translated into machine language before it can be executed on a particular type of CPU • This can be accomplished in several ways such as • A compiler reads a high-level program and translates it all at once, before executing any of the commands. Often you compile the program as a separate step, and then execute the compiled code later. • the high-level program is called the source code, and the translated program is called the object code or the executable.
Programming languages • interpreted language is a programming language whose programs are translated to machine code at the time of execution through using an interpreter program • A compiled language is a programming language which need the use of compilers to generate executable machine code in order to run the program
Compiled Languages executable machine code import java.lang.* --------------------- -------------------- ------- --- ------------- ---- import java.lang.* --------------------- -------------------- ------- --- ------------- ---- Compiler 0010010100110 100101010101 101010101 10101010 import java.lang.* --------------------- -------------------- ------- --- ------------- ---- import java.lang.* --------------------- -------------------- ------- --- ------------- ---- Source Code Print Hello World ------- --- ------------- ---- Run High Level Language code Hello World!
Interpreted Languages import java.lang.* --------------------- -------------------- ------- --- ------------- ---- import java.lang.* --------------------- -------------------- ------- --- ------------- ---- Interpreter Hello World! import java.lang.* --------------------- -------------------- ------- --- ------------- ---- import java.lang.* --------------------- -------------------- ------- --- ------------- ---- Source Code Print Hello World ------- --- ------------- ---- Run High Level Language code
Programming Quality • Efficiency/performance: the amount of system resources a program consumes • processor time • memory space • disk Storage • network bandwidth the less, the better. This also includes correct disposal of some resources, such as cleaning up temporary files and lack of memory leaks.
Programming Quality • Reliability: how often the results of a program are correct. This depends on conceptual correctness of algorithms • Robustness: how well a program anticipates problems not due to programmer error. This includes situations such as: • Incorrect data • Unavailability of needed resources such as memory, operating system services and network connections • User error.
Programming Quality • Usability: the ease with which a person can use the program for its intended purpose • Portability: the range of computer hardware and operating system platforms on which the source code of a program can be compiled / interpreted and run (Java vs C/C++).
Debugging • A methodical process of finding and reducing the number of bugs (errors) in a computer program
Recommended Reading • How to Think Like a Computer ScientistChapter 1, The way of the program http://www.greenteapress.com/thinkapjava/thinkapjava.pdf
Summary • Programming Languages • Compiled Vs Interpreted • Programming Quality • Debugging