Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tonga Institute of Higher Education IT 141: Information Systems

Similar presentations


Presentation on theme: "Tonga Institute of Higher Education IT 141: Information Systems"— Presentation transcript:

1 Tonga Institute of Higher Education IT 141: Information Systems
Lecture 14: Programming

2 Software Engineering Computer programming is also known as software engineering. It covers the entirety of developing software, which includes systems analysis and programming. It can involve hundreds of people and many months or years to finish a really big software project Microsoft Word has about 750,000 lines of code. The US government only thinks a program is big if it is over 1 million lines of code

3 Problem Statement So how do we start engineering software?
It’s best to start with defining the things we need to do and to know A Problem Statement is a list of things that Specifies all aspects of the problem Clearly specifies all the information we know Specifies when the problem is solved With this information, we can figure out the problems we want to solve and how to solve them

4 Algorithms With this information about the problem, we can create an algorithm to solve it. An algorithm is a series of steps that can be written down and coded into a program. If the instructions of an algorithm are followed, then you will always get the right answer (If the algorithm was made correctly) Usually, you must be pretty detailed with your instructions. Computers are stupid.

5 How to write algorithms
Structured English – This is using regular language to write out your algorithm Multiply the length by the height to get the area Pseudo-Code – Mixes programming code and language to make something that looks like code, but would never compile Area = length x height Flowchart – this uses pictures and graphics to help you understand the algorithm

6 Flowchart of Algorithm
Start Input width Input height multiply width height Output area

7 Coding Programs are called sequential order programs, because the commands happen in order. That is unless, you make them go somewhere else Control structures will control the sequence of the instructions in the programming. Examples: if, else, functions, etc They will change the flow of a program

8 Control Structures Sometimes we will draw pretty pictures to show how a control structure works

9 Repetition Controls Repetition Controls are ways to make something happen many times. These are called loops. In programming you may use "for" and "while" to make this happen They’ll have some condition that either makes them continue doing the loop or stop the loop.

10 Debugging And Documentation
To make sure your program works, you have to do a lot of testing. The biggest problem is finding errors or "bugs" and removing them Sometimes testing takes longer than programming People who write programs with lots of problems look like this

11 Errors There are three types of errors you may get when you make a program Syntax errors – when you don’t follow the guidelines of the programming language. Maybe you forgot semi-colons or spaces Run-time errors – errors that happen after you compile and start running a program. Maybe you tried to divide by zero. Logic errors – when your algorithm and procedures don’t do what they are supposed to, but the program still runs

12 Documentation It’s a good idea to put comments within your programs.
It makes it easier for people to read, for you to remember what you did, and also for other people to continue working with your code Once you have a program that runs, it’s also a good idea to have documentation that tells people how to actually use the program.

13 Programming Languages
Hundreds of programming languages have been invented since computers started Some were invented for specific purposes (like business or math) and some are general purpose A “procedural” programming language has a series of statements that execute one after each other. Programs start at the beginning and end at the end. They follow a simple flow through the code, it is easy to see what is happening (one example, BASIC)

14 Programming Languages
Object oriented languages – they try to let programs use an object to manipulate data and change things. An object will be defined by a class. Inside the class there will be methods which allow people to do things to the object. There will also be attributes inside the object which describe something about the object. These are mostly variables that define data inside the object

15 Object-Oriented So why do we use object oriented programming?
It lets many people work on a program at once because they can all work on small parts themselves It lets people use things that others did without having to understand them It lets things be reused a lot, instead of redoing the same thing over and over again

16 Declarative Languages
Declarative languages let programmers define a set of rules and statements about some relationship or problem. Then inside the compiler, it applies those rules to get the answer. The programmer does not have to actually write out the answer, but instead he just writes the rules. Then the compiler does the hard work of solving the problem. One example is SQL

17 Markup and Scripting Languages
We know that markup languages are not really programming languages, because they are simple tags inserted into regular text to make it look different Scripting languages are like most programming languages, except they cannot be run without an interpreter. They are sometimes not as powerful as programming languages that can be compiled.

18 Low-Level Languages Low-level languages (also called Assembly Languages) are used when the programmer wants to work directly with hardware. People who write compilers and who write operating systems use this Machine language - the language of 1s and 0s that the processor uses to execute the program. It cannot really be understood by humans. When computers were first invented people had to use 1s and 0s in order to program Assembly language is the direct translation of machine language. It has simple commands that will change memory or do simple arithmetic. It can be understood by people, but not as easily as high level languages (languages you need to compile in order to change to a low-level language)

19 Compilers Compilers turn your high-level programming language into low level assembly language. Your code is called “source code” The low-level code that comes out of a compiler is called “object code.” Sometimes it is ready to be run right away, because it is an executable. Sometimes it is turned into an “intermediate language.” One example of an intermediate language is with Java. Java allows you to compile your program into “byte-code.” This byte code can then be run on any computer. Java’s goal is to eliminate the problem that programs written on one system cannot work on another.

20 Interpreters Interpreters will only compile one instruction at a time. It will look at the current instruction, turn it into machine language and let it be executed. Then the next instruction will be changed into machine language. It is a little slower than when a compiled program runs because each line of code needs to be changed into machine language as it is running.

21 Event-Driven Some programs run based on something that happens. This is the case in graphical programming. It might wait for a mouse-click, something to move, or something entered from the keyboard These are called “events” and if your program responds to these, it is called an “event-driven” program

22 Components Because of object-oriented programming, you can buy or download components (or objects) that will do things for you. You don’t even need to know how they work You just plug them into your program and use what they do. For example, maybe your program needs to make a graph, so you can get a graph component. This graph component might display a graph for you with the data that you give it (data independence!)

23 Programming Languages Overview
Visual Basic and Basic – procedural programs that can be compiled. Easy to use. Visual Basic very easy to use to make graphical programs. C – procedural programming that gives access to hardware, but is still high-level. Smart people can use C to make their programs very fast, but its hard to learn C++ - like C, but with objects. Many people can’t understand this idea of objects, so they give up

24 Programming Languages Overview
COBOL – language made in the 1960s for large business mainframes. It is procedural, easy to understand and has lasted for a long time Java – high level, object-oriented language that is good for internet programs (called applets) and can run on any computer without being re-compiled Pascal – high level, procedural language made for students to learn with, but nobody can make a real program out of it SQL – the standard, declarative language for using databases.

25 Programming Languages Overview
Perl –It is a high-level scripting language that lets you programming with objects or treat it like a procedural program PHP – Another high level scripting language that is entered right into HTML. .NET Languages (C#, VB.NET) – A new set of languages made by Microsoft that extend older languages by adding object oriented programming and try standardize Windows programming. It doesn’t require types and lets you mix lots of things together. It is also easy to make simple programs. No compiling!

26 Summary Most of the information in this chapter should be familiar with you, after having been exposed to programming already We went over some new things, like different types of languages and different things you can do with objects We also looked at different programming languages and what makes them unique


Download ppt "Tonga Institute of Higher Education IT 141: Information Systems"

Similar presentations


Ads by Google