Presentation is loading. Please wait.

Presentation is loading. Please wait.

Naija Dukes 2011 Nigeria JUG, Lagos Demystifying Programming. Akintayo A. Olusegun, +trinisoftinc,

Similar presentations


Presentation on theme: "Naija Dukes 2011 Nigeria JUG, Lagos Demystifying Programming. Akintayo A. Olusegun, +trinisoftinc,"— Presentation transcript:

1 Naija Dukes 2011 Nigeria JUG, Lagos Demystifying Programming. Akintayo A. Olusegun, Programmer @trinisoftinc, +trinisoftinc, http://www.trinisoftinc.wordpress.comhttp://www.trinisoftinc.wordpress.com NaijaDukes

2 Nigeria JUG, Lagos NaijaDukes The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures. Yet the program construct, unlike the poet's words, is real in the sense that it moves and works, producing visible outputs separate from the construct itself. It prints results, draws pictures, produces sounds, moves arms. The magic of myth and legend has come true in our time. One types the correct incantation on a keyboard, and a display screen comes to life, showing things that never were nor could be.... The computer resembles the magic of legend in this respect, too. If one character, one pause, of the incantation is not strictly in proper form, the magic doesn't work. Human beings are not accustomed to being perfect, and few areas of human activity demand it. Adjusting to the requirement for perfection is, I think, the most difficult part of learning to program. Fredrick P. Brooks.

3 How I learnt Mathematics. 2011 Nigeria JUG, Lagos NaijaDukes If the foundation be destroyed, what can the righteous do?

4 What Is A Computer? Naija Dukes 2011 Nigeria JUG, Lagos NaijaDukes An ELECTRONIC device that can accept data as INPUT, act on or PROCESS the data, STORE the data if necessary and produce a useful OUTPUT. ELECTRONIC: Computers operate on boolean logic INPUT: You can talk to computers PROCESS: Computer can take actions and make decisions STORE: Computers can keep information in memory to be recalled at a later date OUTPUT: Computers can talk back to you. Computer = Input + Process + Storage + Output.

5 What Is Computer Programming? Naija Dukes 2011 Nigeria JUG, Lagos NaijaDukes Programming (or Computer Programming) is a way to tell the computer to behave the way we say it can behave previously. i.e Input + Process + Storage + Output. In the past computer programs are written in binary, as we advance in computing, we also advance in the way we talk to the computer. Today, we can talk to the computer (programming) in very human readable forms. For a full history of computer programming see http://goo.gl/g1R19

6 Assemblers, Compilers and Interpreters Naija Dukes 2011 Nigeria JUG, Lagos NaijaDukes Assembly Language is the lowest level of computer programs these days and the number of assembly language programmers are on the decline. This is due in part to the terseness of the language, and also due in part to the fact that there are programming languages that are very close to human language. As an example to add two numbers, say 4 and 6 in assembly language we will write mov ax,4 mov bx,6 add ax,bx But in high level languages we will simply write 4 + 6 So developers are adopting these high level languages more than assembly language. Also even though assembly language is low level, it still needs to be converted to machine language by what we call an assembler. One thing though is programs written in assembly language can execute noticeably faster than those written in high level languages.

7 Assemblers, Compilers and Interpreters Naija Dukes 2011 Nigeria JUG, Lagos NaijaDukes These days, we often refer to computer programs as source code. Source code makes sense because the programs written in the source code needs to be translated to object code or machine language. A program that does this translation is a Compiler. The job of a compiler most times is to create an executable program from the source code. But the major advantage of compilers is this: Before compilers, programs written in assembly language are machine dependent(Hardware Architecture). But with compilers, you can write your code and make it run on different machines without making changes (or much changes). Compilers take a bunch of code, analyze it and produce an executable. Interpreters however take a source code and run it line by line. If there's an error you get it at run time. Some other interpreters take a source code, convert it into an intermediate, efficient representation and runs it immediately.

8 Programming in Real World Naija Dukes 2011 Nigeria JUG, Lagos NaijaDukes As said earlier, every program you will ever write contains at least one of INPUT, PROCESS, STORAGE and OUTPUT. From the most trivial to the most complex. Let's take a program that just says “hello world” when it is run. This program has just one of the above four, OUTPUT. You can just write print “hello world” Now lets say you want to make this program a bit complex. What if when the program is run, you want to ask the name of the user, then prints “hello “ and the name of the user. You now have INPUT, PROCESS, OUTPUT input name print “hello “ + name The + sign is the process

9 Programming in Real World Naija Dukes 2011 Nigeria JUG, Lagos NaijaDukes Now lets take another example. A program that calculates the sum of two numbers and prints the output. Let's say the numbers are 4 and 6. We can have sum=4+6 print sum But lets make it a bit more complex, say when the program is run, ask the user to enter the two numbers he wants to add and display the output to him/her, we can then have input a input b sum=a+b print sum The first program have PROCESS, STORAGE and OUTPUT. The second one have INPUT, PROCESS, STORAGE and OUTPUT

10 Programming in Real World Naija Dukes 2011 Nigeria JUG, Lagos NaijaDukes As a final example, lets say you are a programmer for a large paleontology firm. Your major problem is calculating the age of dinosaurs from dinosaur bone samples taken from the field. You are then asked to write a computer program they can use to calculate the age of dinosaurs from bone samples because they don't want to do it manually anymore. The same concept applies. INPUT=dinosaur bone sample PROCESS=compute age of dinosaur STORAGE=save bone sample and age for future use OUTPUT=age of dinosaur You can see that we have taken a seemingly complex program, broken it down into these four categories and things are looking easier.

11 Programming Tools – Flow Charts Naija Dukes 2011 Nigeria JUG, Lagos NaijaDukes There are some tools that programmers use to make their job easier. One of them is flow chart. A flow chart is an diagram of some kind that represents a process showing the steps as boxes of various kinds, and their order by connecting these with arrows. This diagrammatic representation can give a step-by-step solution to a given problem Process operations are represented in these boxes, and arrows connecting them represent flow of control This means programmers can look at the problem they are trying to solve as a set of consecutive processes. The flowchart on the left represents the program to add two numbers. Flow charts have specific shapes for specific kind of processes. The ellipses for example is for start and stop. Start Input a Input b SUM=a+b Input a Output sum Stop

12 Programming Tools – Algorithms Naija Dukes 2011 Nigeria JUG, Lagos NaijaDukes Another tool used by programmers is algorithms. An algorithm is a step by step description on how to solve a problem. If you have a well defined procedure for doing something, then you have an algorithm. In computers and mathematics, we can say an algorithm describe a computation that, when executed, will proceed through a finite number of well-defined successive states, eventually producing output and terminating at a final ending state. So the key features of an algorithm are, it has a finite state, the states are successive and it must have an entry and an exit point. It is different from flow charts in that flow charts are diagrammatic while algorithms are not. Most algorithms can be translated to flow charts 1.Start 2.Get a number call it A 3.Get a number call it B 4.Set SUM ← A + B 5.Print Sum

13 2011 Nigeria JUG, Lagos NaijaDukes All programmers are optimists. Perhaps this modern sorcery especially attracts those who believe in happy endings and fairy godmothers. Perhaps the hundreds of nitty frustrations drive away all but those who habitually focus on the end goal. Perhaps it is merely that computers are young, programmers are younger, and the young are always optimists. But however the selection process works, the result is indisputable: 'This time it will surely run' or 'I just found the last bug'. Fredrick P. Brooks

14 NaijaDukes


Download ppt "Naija Dukes 2011 Nigeria JUG, Lagos Demystifying Programming. Akintayo A. Olusegun, +trinisoftinc,"

Similar presentations


Ads by Google