190 likes | 211 Views
Learn about the world of programming, including the skills needed, different programming languages, and the importance of algorithms. Discover how programmers create software and the process they follow to solve problems and bring ideas to life.
E N D
Software is made by programmers • Computers need all kinds of software, from operating systems to applications • People learn how to tell the computers what to do so that the computers do useful things • Software on modern computers usually requires many instructions, millions sometimes so programmers work together in teams at software development companies
Programming skills • Programmers need skills to write good programs • Some can be learned, some are innate • They need to be good communicators, both with machines and with people • They should enjoy logic and mental puzzles • Ideally they also have knowledge of the domain where their programs will be used
Algorithms “Step-by-step procedure” is a mouthful. We have a name for that: an algorithm. • A “well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts in a finite amount of time.” [Schneider and Gersting]. • Steps can be described in English or other natural languages, or programming languages
Programming Languages • The first computer language was machine language, written in binary (first generation) • Humans found it very very tedious • Simple actions took hundreds of machine steps • Humans had to translate their desired steps into machine instructions and then punch them in or toggle switches to make it happen
Assembly languages • Soon the computer operators wanted an easier language to use (second generation) • Assembly languages look a little like English • STO 4, X • JMP LAB1 • ADD 23, X • OUT X • Still lots of steps but a little more understandable, “human-readable”
Assembly languages • But assembly language programs had to be translated back to machine code to be useful • Machine code is the only language CPUs know • The translating program is called an assembler • There are still jobs for people who are good at assembly languages. Assembly is still used in game consoles, appliances, chips controlling machines, etc.
Higher Level Languages • People still wanted easier languages to use, ones that were closer to how humans think instead of how computers work, more abstract (third generation, high-level languages) • FORTRAN was the first commercially successful high-level language (Formula Translator), done in the 1950’s
Compilers • High-level languages also need translator programs – they are called compilers and interpreters • Other high-level languages are COBOL, Basic (all kinds of versions), C, C++, Java, Perl, Python • Some have free translators, some translators cost money
How to Program • Any programmer will have a routine to follow when given an assignment or deciding what they want to program • UNDERSTAND THE PROBLEM – first! • Sometimes they work through it by hand, sometimes they have to ask the customer / manager / employer questions about the details
How to, Part 2 • Make a plan! A test plan! • Involves thinking about how to test the program • Testing? It does not exist yet! But this early planning can give insights into how to solve the problem • Make a design = writing an algorithm in pseudocode • Pseudocode is a structured English, with no strict rules • It’s a way to write a rough draft of a program before it actually gets put into a programming language
A Design in pseudocode • Open the file for reading • Get all the data from the file into a list • Close the file • Start the total at zero • For each item in the list • Add the value of the item to a total • If the value is larger than 75, display a message • Display the total
Programming Languages • Languages (human and computer) have syntax and semantics • The rules you learned in grammar school about spelling, punctuation, subject/verbs, parts of speech, etc. were syntax rules for English • Programming languages have much stricter rules and will not work if you don’t follow them
Semantics • The semantics of a human language is the meaning that the statements convey, the idea that you are trying to send from your brain to your listeners’ brains. • The semantics of a programming language is what does the computer do when the program is translated to machine code and run by the CPU
Syntax to a human is not strictly necessary, we can get meaning from a statement which does not have perfect syntax (things like Twitter messages and text messages, for example) • Syntax to a computer is required to be correct, so programmers have to have pretty good memories to remember the rules of the language
Errors • When an English statement has an error, misspelling, wrong punctuation, wrong word, etc., we can usually figure out what is meant • When a program has a syntax error, it cannot be translated, so it’s useless. Programmers get good at fixing syntax errors • When a program has a semantics error, it is not doing what the programmer meant it to do (that’s called a bug)
Debugging • Debugging (fixing mistakes in programs) is an art • Programmers have tools to help them do this, but it is difficult. That’s one reason software packages have various versions. Bugs get fixed and the fixes are released to the customers
A career as a programmer • Many people are employed as programmers • They may create new programs for their boss • They may maintain programs which are already written, debugging, modifying, updating, etc. • Some people start their own companies to make the software they think will be useful or popular or profitable • Some are self-employed contractors, hiring out to do programming jobs for different companies