Post on 20-Jan-2016
Software Development
Software Development Loop
Design Programmers need a solid foundation before they
start coding anything Understand the task that the program must perform Determine all the steps necessary in order to perform
the task
Understanding the Task Most programming projects begin with an interview
with the end user Programmers must ask lots of questions and get as
many details as possible about the task Follow up meetings are usually required After an interview, a programmer generally
constructs a “software requirement” document This amounts to an agreement between the end
user and the programmer on what the program should actually do
What can happen …
Determining the Steps Next, we need to break down the task into a series
of concrete steps that can be followed (like a recipe) Remember that computers need each step to be
broken down into minute detail They don’t have the ability to infer intermediate
steps or make educated guesses like we can!
Boiling a pot of water
Boiling a pot of water Find a measuring cup Pick up measuring cup Find a sink Walk to sink Turn on water Fill the measuring cup
with 2 cups of water Turn off water Find a pot Pick up the pot
Find a stove Walk to stove Place the pot on the stove Pour the water into the pot Put measuring cup down on
countertop Turn the heat on the stove
to medium-high Wait until the water begins
to rapidly bubble Turn off stove
Algorithms A series of well-defined, logical steps that must be
taken in order to perform a task Algorithms serve as a necessary intermediate step
between understanding the task at hand and translating it into computer code
Pseudocode (aka “fake” code) A useful technique for breaking down an algorithm
into meaningful chunks and aligning them with the toolset of a language
In pseudocode, we don’t have to worry about syntax or spelling, this is for the user
Example – Instagram 1. Start program.
2. Display photos/videos from user’s friends, starting with the most recent.
3. Allow user to scroll up and down through news feed.
4. Automatically playback videos and repeat. Allow users to click on videos in order to play sound.
5. Allow user to “like” photos by double clicking.
Flowcharts A graphical model
that helps programmers visualize the task at hand
Like a decision tree
Software Development Loop
When writing programs … It is very important that you know what your
computer is capable of and what is already accessible to you (types of commands, previously written programs, “packages”, memory capacity, etc.)
What can it do? Most computers can really only do a handful of
things Read information from memory Add, subtract, multiply, divide numbers Compare numbers Move data to memory or permanent storage
What can it do? Processors can only perform a few simple tasks Each processor has it’s own fixed set of capabilities,
known as it’s “instruction set”
Programs In order for a program to be meaningful, it needs a LOT of
instructions, we’re talking millions, maybe even billions Programs are generally stored on external devices but
they must be copied into memory for it to be accessible to the computer (like copying down a set of instructions)
Once it is stored in memory, the CPU can go to work: Fetch Decode Execute Store
So, are you ready to write millions and billions of code … Say “no” …
What’s the solution … ?
High Level Languages Allows users to communicate with
computers in a language more closely related to the English language
Independent of particular computer that is being used
Further away from basic communication with computer, almost like a translator
Examples: Python. C++, C#, objective C, COBOL, BASIC, LISP, Pascal, MATLab, etc.
High Level Languages
JAVA System.out.println (“Hello, World!”);
Hello, World!
PYTHON print (“Hello, World!”)
Hello, World!
Programming Language Structure: Key Words Defined list of words that
make up the language, command codes
These are sometimes called “reserved words”
and as assert break class continue def del elif else except exec
finally for from global if import in is lambda not or pass
raise
return
try
while
with
yield
Programming Language Structure: Operators Special symbols that perform
certain actions on pieces of data
Doesn’t always have to be on numbers
answer = 5 + 2 name = “Donald” + “Seok”
average = 250 / 300 remain = 7 % 2 powers = 4 ** 2
Programming Language Structure: Syntax Set of rules that must be followed when writing a program Comparable to English language grammar
ENGLISH
I runs five miles yesterday.
PYTHON
if name = “donald”:
print (“You’re the bombdotcom!)
else
print(You’re not the bombdotcom!)
ENGLISH
I ran five miles yesterday.
PYTHON
if name == “donald”:
print (“You’re the bombdotcom!”)
else:
print(“You’re not the bombdotcom!”)
Programming Language Structure: Statements Instructions that you write, which consists of
keywords, operators, etc. All statements you write while programming is
referred to as “code” or “source code”
Programming Language Structure: Comments The user can input comments into their code These comments are for the user to communicate
to another human who might be reading through their code
This does not effect the program # First, I will ask the user for their name
# I will then store it in a variable called “x”
x = input (“What is your name?”)
# Now, I will print the name of the user
print (x)
Python Languages are interchangeable in concept,
different words, just like our human languages This year, we will be learning a language called
Python It is a high-level interpreted language Used often as a teaching language, but still very
powerful and used as a production language as well Two modes:
Interactive
Script
IDLE (Integrated Development Environment)