Presentation on theme: "Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get."— Presentation transcript:
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get ready for programming in Python
What is Programming? Put very simply, programming is telling the computer what to do! Programs can be applications on your computer or apps on your phone, but also lots of other things such as macros, web-pages, etc. Some types programs – e.g. Word – run on their own, others – e.g. Scratch or macros – need another program or web-site to make them run. Almost every program that you use will have been “written” by a person – or more likely a team of people.
Different Types of Program Computers don’t understand Python or BASIC or Scratch, so before a program is run, it needs to be converted into a form that the computer can understand, called machine code: Some programs are compiled – the programmer uses a tool called a compiler to convert their program into an executable file that runs on its own. Some programs are interpreted – the interpreter converts the program, possibly line-by-line (or block-by-block in the case of Scratch), as it actually runs. Early programmers also used assemblers to convert low- level instructions into programs, and Java is an exception – it’s half-compiled and then interpreted.
Compilers Most programs that run on PCs are compiled – examples include things like web-browsers, office software and graphics applications. Compiled Windows applications are usually in files that end in.exe – they can be run without the compiler. Programs created in programs such as C/C++ or VisualBasic are compiled – the user doesn’t get to see the original code written by the programmers. Compiled programs usually run more quickly as you don’t have to wait for them to be interpreted. That’s why Android Lollipop compiles apps when you install them – previous versions interpreted them at run-time.
High or Low Level? Where the commands in a programming language resemble words to in English to describe what you want to do, e.g. print, input, if, etc., then the language is described as high-level. Where the commands are less recognisable, and are mainly concerned with technical detail (such as using memory addresses), then the language is described as low-level.
Integrated Development Environment Programmers often use an integrated development environment (IDE) to create programs. An IDE will usually include: an editor, to allow you to create your programs – often they will colour-code aspects of your program, or even suggest which command or symbol might come next debugging tools – e.g. the ability to add breakpoints (where your program will stop and you can look at the value of the variables, etc.) a way of running the program to see if it works Examples include Microsoft Visual Studio and IDLE…
Which Language is Best? Actually, learning to program isn’t just about learning the language. All languages include things like: –Variables –Decisions –Repetition –Events The real skill is being able to take an idea for a program and to use these things to create it
Events We won’t spend much time looking at events to begin with, but events are things that can happen to your program, e.g. –mouse clicks and movements –key presses –screen touches –objects colliding –controls/form fields, etc. getting “focus” You will need to decide what your program should do when these things happen.
Can We Start Now? For this section of the course, we’re going to be looking at the Python programming language. Python is an interpreted language – the programs themselves are just text files so you can use Notepad. It’s much easier, however, to use an IDE – there is a free one called IDLE that works well with Python.
Downloading IDLE and Python Python can be downloaded from: https://www.python.org/download There are two current versions – 2.7.x and 3.4.x – you won’t notice much difference at this stage There are versions for 32-bit Windows and 64-bit Windows – if you’re not sure what you’re using, the 32-bit version will work on both.