Computer Programming


Computer Programming | Coding is a Superpower! | Is Computer Programming hard to learn? | Introduction to Programming with Greenfoot | Review

Computers are everywhere. They are in our pockets. They are on our walls. They are in our cars. They are a critical piece of our infrastructure, from power grids to traffic lights to the inner workings of our financial markets. And all of these computers have one thing in common. They depend on software to tell them what to do.

Manchester Baby

Manchester Baby is world's first stored program computer. Approximately 67 years ago, the Manchester Small Scale Experimental Machine, nicknamed "Baby", became the earliest computer in the world to run a program electronically stored in its memory. This was a flagship moment: the first implementation of the stored program concept that underpins modern computing.

Earlier computers had their instructions hardwired into their physical design or held externally on punched paper tape or cards. Reprogramming them to do a different task entailed internal rewiring or altering the physical storage media. The Baby marked a new computing era, described by some as the “birth of software,” in which swapping programs was far simpler—requiring only an update to the electronic memory. Both instructions and data were held in the Baby’s memory and the contents could be altered automatically at electronic speeds during the course of computation.

The Software Development Cycle

The software development cycle, also referred to as the application development life-cycle, is a series of steps programmers use to build computer programs. It is used in systems engineering, information systems and software engineering to describe a process for planning, creating, testing, and deploying an information system. The creation of software involves six basic activities:

software development modelThe software development models are the various processes or methodologies that are being selected for the development of the project depending on the project's aims and goals. There are many development life cycle models that have been developed in order to achieve different required objectives. The models specify the various stages of the process and the order in which they are carried out.

The selection of a model has very high impact on the testing that is carried out. It will define the what, where and when of our planned testing, influence regression testing and largely determines which test techniques to use.

There are various Software development models or methodologies. They are as follows:

  1. Waterfall model
  2. V model
  3. Incremental model
  4. RAD model
  5. Agile model
  6. Iterative model
  7. Spiral model
  8. Prototype model

Choosing right model for developing of the software product or application is very important. Based on the model the development and testing processes are carried out.

Assignment: Software Development Models or Methodologies discussion board

Directions: Select one of the eight software development models or methodologies and describe how the model works. The read posts by other classmates until you are familiar with all eight models.


Examples of the Importance of Good Upfront Design

The development process is much more involved that this, but these are a few basic development activities

1940 Tacoma Narrows Bridge

Slender, elegant and graceful, the Tacoma Narrows Bridge stretched like a steel ribbon across Puget Sound in 1940. The third longest suspension span in the world opened on July 1st. Only four months later, the great span's short life ended in disaster. "Galloping Gertie," collapsed in a windstorm on November 7, 1940.

The bridge became famous as "the most dramatic failure in bridge engineering history." Now, it's also "one of the world's largest man-made reefs." The sunken remains of Galloping Gertie were placed on the National Register of Historic Places in 1992 to protect her from salvagers.

When Galloping Gertie splashed into Puget Sound, it created ripple effects across the nation and around the world. The event changed forever how engineers design suspension bridges. Gertie's failure led to the safer suspension spans we use today.

Like suspension bridges, computer software must also have good upfront design. Without good design, the resulting software will be full of bugs and doom for failure.

Ariane 5 Rocket Launch

What does the Ariane 5 rocket launch explosion have to do with computer programming? The answer might just surprise you. Watch the video on the Ariane 5 rocket launch.


"One bug, one crash. Of all the careless lines of code recorded in the annals of computer science, this one may stand as the most devastatingly efficient. From interviews with rocketry experts and an analysis prepared for the space agency, a clear path from an arithmetic error to total destruction emerges." Read James Gleick's article A Bug and a Crash: Sometimes a Bug is More Than a Nuisance to learn how a single run-time error brought the giant rocket to the ground.

"There is no life today without software," says Frank Lanza, an executive vice president of the American rocket maker Lockheed Martin. "The world would probably just collapse." Fortunately, he points out, really important software has a reliability of 99.9999999 percent. At least, until it doesn't. The ultimate problems with the launch of the Ariane 5 rocket was a run-time error in the computer software.

Assignment: The Risk Digest Current Event

Directions: Visit the Risk Digest: Forum On Risks To The Public In Computers and Related Systems and read a couple of articles compiled by Peter Neurmann associated with public risk related to computers. Begin reading with the latest edition. Select one article, summarize the article (~150 words) and paste your summary directly to the itsLearning textbox. Do not attach a separate document. Be sure to run spellcheck before submitting your summary. You must cite your source.


"Coding is a Superpower!"

Model and entrepreneur Karlie Kloss shares more about her own interest in learning to code, and why you should give it at least one hour.

Computer programming (often shortened to just programming) is a process that leads from an original formulation of a computing problem to executable programs. Computer programming involves activities such as:

Computer program solves problems that include verification of requirements of the algorithm including its correctness and its resource consumption, implementation of the algorithm in a target programming language, testing, debugging, and maintaining the source code, implementation of the build system and management of derived artifacts such as machine code of computer programs.

The purpose of programming is to find a sequence of instructions that will automate performing a specific task or solve a given problem.

According to a growing number of experts, learning computer science will not only pave the way for future employment prospects - job growth in this sector is booming - but help to accelerate the United States economic recovery.

softwareCode is the foundation of computing. Whether you are using a social media app on your smartphone or working with a cloud server's API, the task relies heavily on a programming language. Ada Lovelace is recognized as the world's first programmer. She wrote an algorithm for Charles Babbage's Analytical Engine. Lovelace's contributions to computing marked the beginning of a rich history in programming despite the first programming languages predate the modern computer.

The first programming languages designed to communicate instructions to a computer were written in the 1950s but the first actual modern programming language is hard to identify.

There are four groups of programming languages and reflect the historical development of computer languages:

Machine code is the only language a microprocessor can process directly without a previous transformation. Currently, programmers almost never write programs directly in machine code, because it requires attention to numerous details which a high-level language would handle automatically, and also requires memorizing or looking up numerical codes for every instruction that is used.

Assembly language has no semantics and no specification, being only a mapping of human-readable symbols, including symbolic addresses, to opcodes, addresses, numeric constants, strings and so on. Typically, one machine instruction is represented as one line of assembly code. Assemblers produce object files which may be linked with other object files or loaded on their own.

High-level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or may automate (or even hide entirely) significant areas of computing systems (e.g. memory management), making the process of developing a program simpler and more understandable relative to a lower-level language. The amount of abstraction provided defines how "high-level" a programming language is.

A fourth-generation programming language (4GL) is a computer programming language envisioned as a refinement of the style of languages classified as third-generation programming language (3GL). Each of the programming language generations aims to provide a higher level of abstraction of the internal computer hardware details, making the language more programmer-friendly, powerful and versatile. While the definition of 4GL has changed over time, it can be typified by operating more with large collections of information at once rather than focus on just bits and bytes. Languages claimed to be 4GL may include support for database management, report generation, mathematical optimization, GUI development, or web development. Fourth-generation languages have often been compared to domain-specific languages (DSLs). Some researchers state that 4GLs are a subset of DSLs.

Assignment: Question for Thought 1

Directions: Compare and contrast past, current, and trending programming languages from low to high level, used in developing software. Your essay should be approximately 500 words and needs to use paragraph headings. Be sure to spellcheck your essay before submitting.


Is Computer Programming hard to learn?

The answer to that question depends upon who you ask!

Key Vocabulary Words

Artifact - something created by humans usually for a practical purpose

Bit - a single 1 or 0 in a binary sequence. The smallest unit of measurement in binary

Byte- a unit of data that is eight bit. A byte is the unit computers use to represent a character such as a letter, number, or typographic symbol.

Low level programming language - a programming language that provides little or no abstraction from a computer's instruction set architecture. Generally this refers to either machine code or assembly language

High level programming language - a programming language with strong abstraction from the details of the computer

Coordinate system - a coordinate system that specifies each point uniquely in a plane by a pair of numerical coordinates x and y

RGB color model - color model used for representing and displaying images in electronic systems, such as televisions and computers

Logic gate - A logic gate is a device, usually an electrical circuit that performs one or more logical operations on one or more input signals. Logic gates are the building blocks of digital technology


Careers in Programming

A computer programmer creates the code for software applications and operating systems. After a software developer designs a computer program, the programmer writes code that converts that design into a set of instructions a computer can follow. He or she tests the program to look for errors and then rewrites it until it is error-free. The programmer continues to evaluate programs that are in use, making updates and adjustments as needed.

Assignment: Virtual Job Shadow

Directions: Visit Virtual Job shadow and learn more about a career as an app developer, GIS manager, software developer, or software engineer. Explore some of the job opportunities as well as the education, skills, and responsibilities. After watching the video on a programmer, summarize what you learned.

Job Shadow Log In


Introduction to Programming with Greenfoot

Object-Oriented Programming in Java with Games and Simulations

Greenfoot logoGreenfoot is a programming environment that can be used by individuals, in schools, or in introductory university courses to learn and teach the principles of programming. It is flexible enough to be suitable for teenagers as well as older students.

Greenfoot supports the Java Programming Language, so students learn standard object-oriented programming in Java. The environment is designed specifically to convey object-oriented concepts and principles in a clean, easily accessible manner.

The Greenfoot environment makes creation of graphics and interaction easy. Students can concentrate on modifying the application logic, and engage and experiment with objects. Developing simulations and interactive games becomes easy, and feedback is immediate. The environment is designed to quickly engage students who may have no prior interest or experience in programming. Achieving simple animation results is quick, sophisticated, professional looking scenarios are possible.

Assignment: Chapter 1

Topics: the Greenfoot interface, interacting with objects, invoking methods, running a scenario

Concepts: object, class, method call, parameter, return value

Directions: You will complete the following assignments for Chapter 1:

  1. Setting up Greenfoot
  2. Read and complete Part1 - Getting to Know Greenfoot (pdf)
  3. Chapter 1 - Part 1 Quiz
  4. Read and complete Part2 - Further Exploration, using Asteroids (pdf)
  5. Chapter 1 vocabulary

We have seen what Greenfoot scenarios can look like and how to interact with them. We have seen how to create objects and how to communicate with these objects by invoking their methods. Some methods were commands to the object, while other methods returned information about the object. Parameters are used to provide additional information to methods, while return values pass information back to the caller.

Objects were created from their classes, and source code controls the definition of the class (and with this, the behavior and characteristics of all the class’s objects).

We have seen that we can change the source code using an editor. After editing the source, classes need to be recompiled.


Assignment: Chapter 2

Topics: writing code: movement, turning, reacting to the screen edges

Concepts: source code, method call, parameter, sequence, if-statement

Directions: You will complete the following assignments for Chapter 2 (Little Crab Game):

  1. Read and complete Part1 - Little Crab, Getting Started (pdf)
  2. Read and complete Part2 - Little Crab, Edge Detection, if-Statement (pdf)
  3. Complete Greenfoot - Chapter 2 Quiz

Bill Gates introduces IF & IF/ELSE Statements

We have seen how to call methods (such as move()), with and without parameters. This will form the basis for all further Java programming. We have also learnt to identify the body of the act method-this is where we start writing our instructions.

You have encountered some error messages. This will continue throughout all your programming endeavors. We all make mistakes, and we all encounter error messages. This is not a sign of a bad programmer-it is a normal part of programming.

We have encountered a first glimpse of inheritance: Classes inherit the methods from their super classes. The Documentation view of a class gives us a summary of the methods available. And, very importantly, we have seen how to make decisions: We have used an if-statement for conditional execution. This went hand in hand with the appearance of the type Boolean, a value that can be true or false.


Assignment: Chapter 3

Topics: random behavior, keyboard control, sound

Concepts: dot notation, random numbers, defining methods, comments

Directions: You will complete the following assignments for Chapter 3 (Little Crab Game):

  1. Read and complete Part3 - Little Crab, Random Behavior (pdf)
  2. Complete Chapter 3 - Part 3 Quiz
  3. Read and complete Part4 - Little Crab, Adding Classes & Methods (pdf)
  4. Complete Chapter 3 - Part 4 Quiz
  5. Read and complete Part5 - Little Crab, Adding an Enemy (pdf)
  6. Read and complete Part6 - Little Crab, Keyboard Control (pdf)
  7. Complete Chapter 3 - Part 6 Quiz
  8. Read and complete Part7 - Little Crab, Adding Sound (pdf)
  9. Chapter 2 & 3 Test

Chris Bosh explains Functions

We have seen more examples of using an if-statement—this time for turning at random times and reacting to key presses. We have also seen how to call methods from another class, namely the getRandomNumber, isKeyDown, and playSound methods from the Greenfoot class. We did this by using dot notation, with the class name in front of the dot.

Altogether, we have now seen examples of calling methods from three different places. We can call methods that are defined in the current class itself (called local methods), method that were defined in a superclass (inherited methods), and static methods from other classes. The last of these uses dot notation. (There is one additional version of a method call: calling methods on other objects-we will encounter that a little later.)

Another important aspect that we explored was how to read the API documentation of an existing class to find out what methods it has and how to call them.


Assignment: Chapter 4

topics: world initialization, setting images, animating images

concepts: constructors, state, instance variables (fields), assignment, new (creating objects programmatically)

Directions: You will complete the following assignments for Chapter 4 (Little Crab Game):

  1. Read and complete Part8 - Little Crab, Initializing the Game (pdf)
  2. Read and complete Part9 - Little Crab, Animation (pdf)
  3. Read and complete Part5 - Little Crab, Keeping Score and Extensions (pdf)

Mark Zuckerburg teaches REPEAT LOOPS

Chris Bosh explains REPEAT UNTIL

We have seen a number of new programming concepts. We have seen how constructors can be used to initialize objects—constructors are always executed when a new object is created. We have seen how to use instance variables-also called fields-and assignment statements to store information, and how to access that information later. We have used the new statement to programmatically create new objects, and finally, we have seen the full version of the if statement, which includes an else part that is executed when the condition is not true.


Assignment: Chapter 5

Topics: sound

Concepts: abstraction, loops, arrays, OO structure

Directions: You will complete the following assignments for Chapter 5 (Making Music: An On-Screen Piano):

  1. Read and complete Part1 - An On-Screen Piano (pdf)
  2. Read and complete Part2 - An On-Screen Piano (pdf)
  3. Read and complete Part3 - An On-Screen Piano (pdf)
  4. Read and complete Part4 - An On-Screen Piano (pdf)
  5. Read and complete Part5 - An On-Screen Piano (pdf)
  6. Read and complete Part6 - An On-Screen Piano (pdf)

We have seen two very fundamental and important concepts for more sophisticated programming: loops and arrays. Loops allow us to write code that executes a sequence of statements many times over. The loop construct we have discussed is called a while loop. Java has other loops as well, which we will encounter shortly. We will use loops in many of our programs, so it is essential to understand them.


Assignment: Chapter 7

Topics: more about movement, keyboard control and collision detection

Concepts: collections (again), for loop, for-each loop (again), casting

Directions: You will complete the following assignments for Chapter 7 (Asteroids):

  1. Read and complete Part1 (pdf)
  2. Chapter 7 - Part 1 On-line Assessment
  3. Read and complete Part2 (pdf)
  4. Chapter 7 - Part 2 On-line Assessment
  5. Read and complete Part3 (pdf)
  6. Chapter 7 - Programming Rubric for Summative Grade (pdf)

Here are some helpful videos for creating explosions:

We have worked on completing an asteroids game that was initially half-written. In doing this, we have encountered several important constructs again that we had seen before, including loops, lists, and collision detection.

We have seen one new style of loop-the for loop-and we have used it to paint the stars, and to generate the proton wave images. We have also revisited the for-each loop when we implemented the proton wave functionality.

Two different collision detection methods were used: getOneIntersectingObject and getObjectsInRange. Both have their advantages in certain situations. The second one of those returned a list of actors to us, so we had to deal with lists again.

Understanding lists and loops is initially quite difficult, but very important in programming, so you should carefully review these aspects of your code if you are not yet comfortable in using them. The more practice you get, the easier it becomes. After using them for a while, you will be surprised that you found them so difficult at first.



Review

Quiz created by sarush with GoConqr

Resources

Channel Greenfoot: https://www.youtube.com/user/18km

Download Greenfoot (free): http://www.greenfoot.org/door

Introduction to Programming with Greenfoot by Michael Kolling: http://medziaga.puslapiai.lt/Introduction_To_Programming_With_Greenfoot.pdf

Java Game Programming with Greenfoot Part 1: https://youtu.be/NcGe141R2yA?list=PL84B14314CEBAC375

Java Game Programming with Greenfoot Part 2: https://youtu.be/qL1fKWcT64I?list=PL84B14314CEBAC375

Greenfoot Tutorial Videos on YouTube: https://www.youtube.com/playlist?list=PL84B14314CEBAC375


Credits

Software picture: http://www.processing.lyndondaniels.com/1about.php

We've Come a Long Way Baby: https://googleblog.blogspot.co.uk/2013/06/youve-come-long-way-baby-remembering.html