Slide 1

Slide 1 text

Language Overview and Procedural Programming Class Nine: January 30, 2014

Slide 2

Slide 2 text

Programming Languages Programming languages are used for controlling the behavior of a machine (often a computer). Like natural languages, programming languages conform to rules for syntax and semantics. Objective C, Ruby, Python, PHP, C#, Go, Java, C, C++ Many, many, MANY others.

Slide 3

Slide 3 text

How Should I Proceed? Early on, I would say it’s important to focus on some “non- functional requirements.” A requirement that specifies criteria that can be used to judge the operation of a system, rather than specific behaviors. Scalability, Maintainability, Reliability, Availability, Extensibility, Performance, Manageability, Security

Slide 4

Slide 4 text

Where do I Start?! • Code Wars: Ruby vs Python vs PHP • Choosing a Programming Language: So easy, a caveman can do it • Programming Language Comparison • How to Pick the Right Programming Language • Choosing a Programming Language • How do you choose to use a specific programming language?

Slide 5

Slide 5 text

Comparison to Human Language Different languages are capable of communicating ideas differently. Mamihlapinatapei: Yagan (indigenous language of Tierra del Fuego) – “the wordless, yet meaningful look shared by two people who both desire to initiate something but are both reluctant to start.” But languages share many commonalities. Same goes for programming languages. E.g. if you know the generalities of noun/verb interactions, it’s easier to learn a new language. !

Slide 6

Slide 6 text

Procedural Programming A programming paradigm based upon the concept of the procedure call. Procedures, also known as routines, subroutines, methods, or functions simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program's execution, including by other procedures or itself. !

Slide 7

Slide 7 text

Procedural Programming In short, procedural programming could be regarded as a list of instructions telling a computer, step-by-step, what to do and usually having a linear order of execution from the first statement to the second and so forth with occasional loops and branches. Modularity is generally desirable, especially in large, complicated programs. Inputs are usually specified syntactically in the form of arguments and the outputs delivered as return values. !

Slide 8

Slide 8 text

Procedural Programming Modularity is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality. Scoping is another technique that helps keep procedures strongly modular. It prevents the procedure from accessing the variables of other procedures (and vice-versa), including previous instances of itself, without explicit authorization. !

Slide 9

Slide 9 text

Procedural Programming Design Method = Top Down. This is where you start with a problem (procedure) and then systematically break the problem down into sub problems (sub procedures). This is called functional decomposition, which continues until a sub problem is straightforward enough to be solved by the corresponding sub procedure. !

Slide 10

Slide 10 text

Procedural Programming Issues The difficulties with this type of programming, is that software maintenance can be difficult and time consuming. When changes are made to the main procedure (top), those changes can cascade to the sub procedures of main, and the sub-sub procedures and so on, where the change may impact all procedures in the pyramid.

Slide 11

Slide 11 text

SegSim Explanation “Segregation Simulation”: A simple model for investigating how over time communities can become segregated based on various prejudices. 1. Break the problem down into one dimension; a street initially populated with equal probability either black ‘B’, white ‘W’ or empty ‘ ‘ houses. 2. We then allow the system to evolve by randomly selecting houses and applying a simple condition: If the house is surrounded on both sides by a house different to itself, it will decide to move to an empty location in the street where this condition is not satisfied. In the unlikely event that a suitable location cannot be found after a designated number of attempts, the house will leave the street.

Slide 12

Slide 12 text

SegSim Sample Output | BW W BWB BWBBWWBWWW W B BW BW WW BWW BWWW | : 17   | BW W BWB BWBBWWBWWW WBB BW BW WW WW BWWW | : 15   | BW W BWB BWBBWWBWWW WBB B BWWWW WW BWWW | : 13   | BBW W BWB BWBBWWBWWW WBB B WWWW WW BWWW | : 11   | BBW W BWBBBWBBWWBWWW WBB B WWWW WW WWW | : 8   | BBW BWBBBWBBWWBWWWWWBB B WWWW WW WWW | : 6   | BBW BWBBB BBWWBWWWWWBB B WWWW WW WWWW | : 5   | BBW WBBB BBWWBWWWWWBB BB WWWW WW WWWW | : 3   | BBWW BBB BBWWBWWWWWBB BB WWWW WW WWWW | : 1   | BBWW BBBB BBWW WWWWWBB BB WWWW WW WWWW | : 0

Slide 13

Slide 13 text

SegSim Modified Rules Suppose we want to add a different type of house that plays by different rules, then see how the simulation differs? Consider a nomad type house (label ‘N’) which does not care about its neighbors. However, it remembers how long it has been in one location, and if longer than a specified threshold it moves to a new location. How must we modify the original program in order to account for these new rules?