Chapter 1 Understanding Program Logic and Programming
Chapter 1 Understanding Program Logic and Programming
2. Describe the relationship between computer programming logic and computer programs.
3. Explain the process of solving a problem with program logic and a computer program.
4. Describe why program logic is modeled with pseudo code and flow charts before being
transformed into a program.
6. Describe the roles and responsibilities of programmers and the processes programmers
use to create programs.
Programming logic is the central focus in this eBookalong with how they are used by
programmers to write efficient and effective computer programs. Every program
should start with program logic, which is the blueprint, and end with the coding of
programming language statements. The initial chapters of the eBookwill be dedicated
to logic structures and specifically, structured programming. In later chapters, we will
tackle more challenging programming techniques like object orientated and event
driven programming.
As a programmer who has been writing programs for more than twenty years, I have
always enjoyed the challenge of programming and I hope that my passion for
programming will rub off on you also. For me, the next best thing to writing my own
programs is helping a new programmer learn how to write their own programs. There
is nothing more rewarding then to see the pride of accomplishment in a students face
when they create their first computer program. Let’s get started…..
When we learn about logic and programming, we will always examine WHY we are
using that logic structure or programming methodology. Whenever a new topic is
introduced we will stop to discuss WHY that topic best fits the situation we are trying
to solve. We will follow this explanation with examples. The examples will include
pseudo code, flowcharts, UML (Unified Modeling Language), PYTHON programs,
illustrations and case studies. In this wiki, we will use a variety of approaches and
different learning styles to provide real life solutions to real business problems. We
will apply concepts to case studies and assess our progress to get feedback on in
understanding how and why the topics of that chapter are important to becoming
successful programmers.
There are many textbooks that teach you how to program. These textbooks cover the
syntax and structure of how programs are constructed specific to a particular
programming language. One of the more popular programming languages is
Microsoft’s Visual Basic. In the typical introductory Visual Basic class, the student
learns Visual Basic statements and keywords, how to implement programming logic
and structures and finally, how to use the Visual Basic development environment to
build and test his program. This approach to learning programming stresses how to
create Visual Basic programs but not effective programming logic design. There is a
weakness in learning programming with this approach. The emphasis is not on WHY it
needs to work a certain way but instead what it will look like. As you’ll see in this
wiki, the direction will in formulating efficient, flexible, reusable, high quality
programs that follow accepted programming standards.
Since the logic is used to design the solution, you must also understand that
construction of logic are key to good programming. Let me illustrate with an
example. I think most of us would admit you probably don’t have to be an architect
to design a house. After all, most of us have had some experience living in a house.
Through this experience, we could design what you would find in your typical house
(rooms, doors, windows, roof, etc.). I also think most of us would be able to assemble
something that looked like a house if given the appropriate building supplies and
tools. We could build a house that had at peaked roof, had some windows, had a
front door and would have walls and ceilings that would make the house habitable.
From a distance, the house might look like every other house on the street. However,
would the house be structurally sound? Would the house meet the appropriate
construction code regulations? If another plumber or electrician came to this house
and had to make a repair, would they be able to? What this house we built meet the
professional standards found in the work of professional builders, plumbers and
electricians? I don’t think so. We know how to build it but not why a floor needs
certain supports or why wall studs hold up the ceiling.
This same analogy holds true in first time programming classes. Many times because
of time constraints and the amount of material that must be learned, entry level
programming classes have to focus on the “HOW” and not the “WHY” of a
programming language. “HOW” might get the assignment done and a compiled
program but it does not necessarily make you a programmer. Once you know “WHY”,
you can use the “HOW” to implement the solution. Once we know the “WHY” of
programming logic and how to use structured and object oriented fundamentals, we
will be able to build programs that follow professional standards for design, and
maintainability. Knowing “WHY” we do things is what makes the practitioner a
professional. In our case, knowing “WHY” is important in becoming an effective
programmer.
The goal of this eBookis to teach you about programming. Programming is a process
and made up of several activities. The program process starts with the modeling of
logic. This is also where we will focus much of our instruction. It is often is the
neglected piece of the programming processes but critical for new programmers.
Once the logic is complete programming starts. A completed program must finally be
tested before put into production. This eBookwas designed to provide instruction on
programming for a variety of programming languages (language independent). The
process of programming is the same no matter what programming language is used
(i.e. Visual [Link], C++, C# or Java).
This could not be any farther from the truth. One of the difficulties in learning how to
implement programming logic is the constraints the computer places on us in solving
business problems. The human brain is far more complex and the brain’s ability to
reason and learn far exceeds that of a computer. Computers are only as smart as the
persons programming them and you must condition yourself into providing an
instruction (logic) for everything a computer program needs to do. Planning or
modeling program logic before we create programming statements is one way for the
programmer to condition the solution into one the computer can perform. Without a
logic model it is easy for the new programmer to assume the computer can perform
more than it is able. We will learn more about logic structures in later chapters but
first we will give you a first look.
I often use the example of making a peanut butter sandwich to illustrate the
intelligence (or lack of) of the computer. Making a peanut butter sandwich is a task
that any three years old could handle. Let’s see what we would have to tell the
computer in the form of logic instructions to make a peanut butter sandwich. I will
accomplish this by documenting the logic necessary with a programming modeling
language called pseudo code to build the necessary instructions.
In Practice: Pseudo code for Creating Programming Logic - Pseudo code has long been used as
a mechanism for modeling logic before the logic is implemented as source code statements in a
program. We will formally introduce pseudo code later in the wiki. We use pseudo code because
it is an excellent way to just concentrate on programming logic without being constrained by the
rules of a specific programming language. The beauty of pseudo code is that since it is a list of
English instructions, you can easily document the process steps and validate the steps with
others. Even persons with no formal understanding of programming logic or programming, can
participate in the creation of pseudo code. Pseudo code is not like a formal programming
language and if you can read you can follow logic documented in pseudo code.
One of the difficulties in teaching logic with pseudo code has been its nonstandard
nature and the fact that since it is not a true programming language, the logic
statements can not be executed on a computer. By not being able to execute the
logic, it is not possible to validate the program logic to make sure that it was
constructed correctly and arrives at the correct solution.
Status Check:
Why logic is modeled first rather then just writing the program from scratch?
Let’s set up the logic instructions with the following scenario. You have at your
disposal a kitchen robot. This kitchen robot is capable of taking instructions that will
allow it to move around a kitchen, find various food ingredients, and mix and prepare
those ingredients. Your pseudo code program needs to give the robot the instructions
to create a peanut butter sandwich.
Search shelf
Search shelf
o If peanut_butter not found then Display “No peanut better today Msg.”
I think you can see what is happening here. What would be a very easy task for your
typical three year old to accomplish becomes very difficult for the computer because
of the amount of logic detail we must supply. It’s not so much that programming
logic is complicated but more because of the amount of detail we have to build into
our instructions. Our brain is much more sophisticated and powerful and works much
differently than a computer. Because of this, we have to break down even simple
tasks to a much lower level so that the computer can process them successfully.
Logic Tip: Most students will initially have a problem with program logic because
they are not familiar to the very unnatural process of breaking down instructions to
the computer at that low a level. We will be the chance to learn more about logic in
later chapters.
After seeing how complex a peanut butter sandwich becomes when documented as
logic steps, was it the computer that caused the problem or was it the programmer of
the computer application? What was needed was additional program logic in the
payment processing program that would have softened the penalty if the under
payment was less $10.00 dollars. Unfortunately, blaming the computer is very easy
but also very incorrect (not to mention the additional cost associated with losing a
previously loyal customer). Now I’ve let you in on that secret. The real brain behind
the computer program is the person who programmed it.
Related Subject: Blame it on the computer – “The computer did it!”: Have any of
you ever experienced this? An organization you do business with has made a mistake
concerning your account (i.e. they forgot to credit a returned item to your monthly
statement). Their response to the error is, “the computer did it. It is not our fault!”
I can fondly remember one day receiving a rather threatening notice from a local
department store because my payment had mistakenly been processed $2.00 short
of the monthly invoice amount. Needless to say, I wasn’t happy when they
threatened to turn me into a credit agency for two dollars. I called the customer
service department to communicate my dissatisfaction. The person on the other end
of the phone, although apologetic, could only say that my problem was the result of
the computer causing an error. No person there was certainly at fault. “You know
these computers, they are always making errors.” The computer was cause of my
problems. The computer was the one I should direct my displeasure to. I asked if I
could talk to the computer. The phone went silent.
In this wiki, you will see repeated references to program logic and application
computer programs. We are focusing on program logic in this eBookbut it is
important that we also refer to programs since the two subjects are so closely tied to
one another. We will do a more formal introduction on programming in the next
section but look at the relationship between program logic and a computer program
in the following diagram (see Figure 1). Note how programming languages also use
English like statements to represent instructions to the computer. Computers do not
speak English (although I talk to mine all of the time).
Figure 2: The graphic represents the relationship between program logic and a
computer program. Pseudo code statements from Box A are converted by the
program to program language statements (PYTHON) shown in Box B
We will use four approaches to model program logic. The simplest approach is
pseudo code. As we get deeper into the eBookand begin our learning on structured
programming, we will introduce flow charting. Flowcharting is the most graphical of
the three approaches we will cover and we will introduce flow charting in a later
chapter.
I can still remember the day when I was asked by the Leader of my daughters Girl
Scout troop to come in on career day and describe to the other Girl Scouts what I did
for a living. Maybe the truest test of understanding a subject matter is to take
something that can be as complicated as programming and reduce it to an
explanation that even the youngest of students can understand.
Status Check
Why is the computer program only as good as the programmer programming it?
What are some of the advantages of using a programming language liek PYTHON to
help learn about program logic?
Can you define and differentiate between program logic and programming?
Now would be a good time to introduce you to some different types of computer
programs. Yes, not all computer programs are the same. Our example program
(adding two numbers together) was a custom application program used for a specific
business problem (adding two numbers together). This is not the only type of
program. The Windows XP operating system program that came with our PC is also a
computer program. It differs in both complexity and purpose but it is still a program.
Even though these programs has a very different purpose, they were all built from a
logic model and converted into computer programming language statements.
Most computer programs fall under three classifications. These classifications are
operating systems, packaged applications (also called shrink wrapped applications
because they are sold in the store boxed in plastic) and custom applications which
are written to solve a specific problem. The applications we will create and execute in
this eBookare custom applications since they are created as business applications for
individual use.
Key Concepts: Operating systems allow for the execution of applications programs.
Packaged software are application programs which are written to solve a particular
type of generic problem. For example, a spreadsheet application is a program which
is designed to provide a matrix of rows and columns where data and expressions can
be inserted and manipulated. The program has a generic quality that allows it to be
used for a number of different activities related to manipulating and modeling
numbers. Spreadsheets are very popular with people who work with accounting
tasks. Packaged software application programs need to have an operating system
installed before they can be executed.
In Practice: SDLC – System Development Life Cycle in Detail: SDLC stands for
system development life cycle. It is a methodology/process used by people who work
in information technology to solve problems to providing effective and efficient
solutions. It remains as the foundation for planning and implementing most systems
projects (i.e. application programming). If not for programming, SDLC can also be
used for hardware and networking projects. It represents a common tool that you will
frequently encounter in working with computer systems.
System Development Life Cycle: I tell students that using SDLC is an exercise in
common sense. Do not let the term intimidate you. It sounds very complicated but in
fact is a very logical way of approaching and solving a complex problem. In short,
SDLC is a “rifle approach” (versus and unorganized shot-gun approach) to quickly
and successfully solve a problem. It includes four common sense process steps to
solve any type of problem (1) define the problem and assign it a priority (2) analyze
the problem particulars and identify possible solutions, (3) design a solution and (4)
implement your solution. This process is not just for computer programming. It
should work on everything from fixing a flat tire to building an operating system. It
works because it documents a plan of attack that logically focuses on a problem and
identifies alternatives.
1. Planning - Defining the problem and prioritizing against other programming projects
3. Design - Develop problem alternatives. and models to represent problem and solution
SDLC contains a series of steps that must be completed as phases. For example, the
first phase needs to be started before the second phase and the third phase is to be
started before the fourth face and so on. Even though there is this dependency there
is also no reason why there cannot some be parallel activity. By this I mean one
phase can start before the preceding face is completely finished. SDLC has been
called a “waterfall” approach because one phase flows into the next phase.
Key Concept: SDLC can loosely be defined as exercising common sense. Most
problems, computer or non-computer, can be solved by using a logical common
sense approach to solving the problem. After all, aren’t most problems solved by
getting the facts, designing a solution and implementing the solution? It could be a
math problem, a science problem or a problem with your car, the approached
suggested in SDLC could work for them all.
PROGRAM DEVELOPMENT PROCESS
Key Point: SDLC and the PDP are not industry standardized processes. In other
words, you may find different various versions of each depending on the
development process you are using. The PDP, in particular, is a process created
specifically for the eBookas a composite of other similar program development
processes used in the industry. If your SDLC and PDP phases look different that in
other textbooks, look at the activities in each phase and you will see that even if the
phase name is different, the spirit of each phase is the same.
Status Check:
What are the different types of computer programs?
Why was it written that we are concentrating on custom applications in this wiki?
PLANNING
Start with a problem statement: I need a program that will calculate the test scores
for a class of 15 students and tell me the average test score.
REQUIREMENTS ANALYSIS
*Fact finding or requirements analysis (done by interviewing the end user): Do you
have an example of how you want the average number displayed? Do all of the test
scores need to be displayed or just the final average? How would you like to input the
scores? One at a time or all at once? What if there are less than 15 scores?
Design
Conceptual design: Conceptual design usually takes the form of a logic model that lays
out the ideal logic structures to provide a solution. In conceptual design, we will program
the expressions needed to calculate the average along with the logic necessary to accept
the inputted values.
Detail design: We are ready to code our solution using a programming language. We
take the conceptual design as a starting point and using the syntax options of the
programming language, code the logic structures into programming language structures.
Testing: We will perform unit tests as we go. Unit testing is used to test sections of the
entire program. A system test will be performed at the end of the process to make sure
our scores are calculating correctly and that any errors are flagged for the end user.
IMPLEMENTATION
MAINTENANCE
Maintenance: No program is written once and not revisited without some changes. No
sooner than the user started to use this program then did they decide that it would be
useful in their other classes. The other classes have different numbers of students so that
a program that score 15 tests needs to be changed to a program that scores however
many tests the user has to grade. We now start back up at the problem statement and
move through the phases once more for this program maintenance.
The following processes and activities are not defined specifically to one program
development phase but in fact can be a part of several or all of the PDP phases.
DEPLOYMENT:
Deployment concerns the techniques that will be used to deliver your program to
your users. Deployment is affected by options available for the distribution of
software (i.e. some user’s computers will have to be updated by CD-ROM or updated
via the Intranet/Internet) and the type of program (Internet or Desktop). You’ll also
want to consider if automatic configuration is required by your program. This might
include placement of an icon on the users desktop or placement of the program in
the programs start menu (in the case of Microsoft Windows).
Internet applications have different deployment concerns and require planning
throughout the PDP process. Programs do exist for the programmer to assist in
deployment. Understanding the features and functions of these products early in the
detail design process can make deployment much easier when the project reaches
implementation.
TRAINING/DOCUMENTATION:
It is very easy to forget about training and documentation until the project is
complete. Many times training and documentation is either ignored or given no
consideration at all. You need a look this task as one of the ways to ensure your
programs success. If users cannot understand how the program works, they will both
reject the program out of frustration or turnaround and request a number of
modifications which will only lengthen the amount of time and cost needed to
complete the software.
PROJECT MANAGEMENT:
Not all programs are contained in a single file and programmed by one programmer.
Depending on the size of the application project, you may be part of a team who is
developing a new system. This team may be developing 20 are 30 programs
independently of one another but programs which will need to function in concert
with one another at the project’s conclusion. To facilitate an effort of this magnitude,
typically a project manager is assigned to the project. The project manager will likely
use project management software. Project management software packages are
designed to improve the productivity of the entire team by keeping track of who’s
doing what and in what sequence. It helps ensure that programs are developed on
schedule and that one programmer is not held up waiting for the work of another
programmer to be completed.
Status Check:
Why is deployment, project management and training outside the tasks in PDP?
Each chapter will have a common case study to integrate topics covered in the
chapter. Cactus Books and Tapes is a fictitious small business run by two sisters who
are just starting to incorporate technology to meet their growth. Like most small
businesses they are trying to use Internet to improve customer service and increase
sales. The case study will also parallel the assignment cases studies found at the end
of each chapter.
Cactus Books and Tapes (CBT) was opened in 1998 by two sisters who saw a
business opportunity in the sales and rental of audio tapes. The business began with
a small store in a strip mall near a large office complex. The traffic to the store has
always been good and because of the prudent planning of Christina and Lois Chavez,
the store expanded from the selling of tapes to also books. The theme of the
bookstore is still focused on self-help materials but the Chavez sisters carry best
sellers and do a good business in custom orders of books and tapes. The store added
a new location last year and the business continues to grow. The new store includes
a coffee bar and an area for customers to read and enjoy a cup of their favorite tea or
coffee. Many of the CBT customers would like to request custom book orders on the
Internet instead of driving to the store or having to worry about someone being
available to answer the phone. The sisters see the development of a web page to
accomplish this as a critical project for continued store success.
The store is organized as a partnership between the two sisters. The business has
combined retail space of 25,000 square ft (10,000 feet at first location and 15,000
square feet at the new location). Christina manages the original location and
supervises the accounting for the business (accounts payable, accounts receivable,
payroll and human resources). Lois manages the new store and has been focusing
her attention on managing the stores new coffee bar. The business has two assistant
managers at each store (day and evening shifts) and has approximately 35
employees combined. The store is open 6 days a week from 9 a.m. to 9 p.m... Sales
volume from both stores is approximately $750,000 dollars per year.
Since neither Christina nor Lois has extensive computer experience they have
contracted your expertise as an outsourced employee who will help them in the
design of their Internet book order service. Outsourcing is an excellent way for an
employer to be able to work with and evaluate the knowledge of a potential new hire.
Since CBT has a good benefits plan and competitive salaries, this is an excellent
opportunity for you to get on to the ground floor of a growing small business.
Your first challenge is to map out a plan of action so that the design of the Internet
book order service will be successful. You will use the steps outlined in the program
development process and with SDLC to let the Chavez sisters know what steps need
to be performed to complete the project.
To do this you have decided to use an SDLC diagram to provide a high level picture
of the overall plan and the program development process to outline the specifics
required to build the programs used to capture Internet book orders.
Taking your program logic and converting it into a compiled program so that it can be
executed on the PC requires several steps and various tools. First and foremost, the
programmer must decide which computer language they will implement their
solution in. Each computer language is similar and is different. Most computer
languages are similar in that they use common structures (the structures we will be
learning in this wiki) and different in that they use different keyword statements and
syntax.
Tip: The Internet is a great source for researching the different programming
languages. Many languages are in the public domain and programming tools exist to
learn these languages at no cost (providing you have a personal computer).
Many computer languages have been standardized so that their use can be applied
across multiple hardware platforms and operating systems. Popular languages such
as Java are available on everything from a supercomputer to a cell phone. The recent
trend in new programming languages is to create languages that support structured
and object oriented programming (both which will be covered extensively in this wiki)
across multiple operating system platforms. For example, in object orientated
programming there is a great advantage in being able to create class objects (blocks
of logic statements) that can be reused over and over again in multiple programs.
Since programming has always been a primarily labor intensive activity, any
developments, like code reuse, which allow programmers to create code faster and of
higher quality is seen as important. Java and C# (C sharp) are two contemporary
languages which were designed specifically for programmer productivity (with code
reuse support) and for support across multiple computing environments. Older
languages, such as BASIC, have continued to be modified in upgraded to support
several of these same code reuse capabilities to also improve programmer
productivity.
The IDE is the programmers’ toolbox and contains software that will make the
programmer work quicker and more effectively. Although the only computer
language we will specifically use in this eBookis PYTHON, it is appropriate to talk
about some of the various ways contemporary computer languages facilitate the
creation of executable programs. We will have samples of Java and Visual Basic also
included from time to time within the wiki.
Integrated Development Environment: Since programming is a labor intensive
activity, the programmer needs tools just like a carpenter needs a saw. The IDE
provides the tools you need to become a more efficient programmer. The IDE will at a
minimum include a programming source code editor, a run-time debugger to help
find errors, a compiler to create an executable version of the source code and usually
on-line help with programming language documentation.
Program language syntax rules are the rules of grammar for a particular
programming language. Some programming languages require that each statement
end with a semi colon. Some programming languages have specific requirements as
to how variables must be declared and referenced. All programming languages have
slightly different syntax rules just as French is different than Spanish is different then
English. Just like it takes time to understand the syntax of Spanish, programming
language syntax also takes time to learn.
Debugging the program is the process of examining program logic for errors.
Programming errors and errors in general have been called bugs. The origination of
the term goes back to the very first computers when a gypsy moth flew too close to a
vacuum tube and caused the computer to fail. Since the problem was truly a bug
(insect), the computer operator coined the expression “bug in system” to describe
the problem. The word caught on and computer problems have been referred to as
bugs ever since then. The act of removing bugs (or problems) from program logic is
called debugging. Software that helps to remove problems is called a debugger. A
more traditional word for this activity is troubleshooting which means the same as
debugging.
As you take your first programming class, experience with programming syntax can
be one of the more frustrating activities. It’s not unusual to stare at a program
statement for fifteen minutes trying to understand the syntax error, only to have a
more experienced person find what is missing, in less than 30 seconds. Whereas the
English language allows us to have lapses in our use of grammar, a computer
program is very specific and as mentioned in an earlier section of this chapter,
computers must be told exactly what to do or they will not be able to do it. The
compiler and interpreter will report syntax errors to the programmer and will not let
program execution continue until the syntax error is fixed. We will see evidence of
syntax rules as we work with PYTHON to develop our program logic.
Programming language Syntax: All new programmers with remember there first
syntax errors with great fondness…NOT! Learning the syntax (or grammar) of a
programming language can be compared with learning any new language. It is much
easier reading at a foreign language then it is to speak it. This is because to speak it
we have to have a strong knowledge of the languages syntax. It takes time and it is
frustrating by rest assured, we have all been there.
There has been a lot of work done recently in studying programming patterns.
Patterns are blocks of logic (later converted to programming statements) that
represent common logic blocks. The logic statements together would represent a
task that you would use again. Maybe a pattern might be reading a file until you have
reached the last record. Common logic patterns like reading a data file is the type of
logic block that would be easily reused across a variety of different programs.
INTERPRETER BASICS
Aside from compilers which create executable machine code, many languages also
support interpreters. It is important to note, some programming languages can only
be executed with an interpreter. What this means is that rather than creating
(compiling) a file of machine code instructions executed by the operating system, the
interpreter is a program that reads the source code line by line and converts it into
machine code instructions. Interpreters offer some advantages when writing new
code but have typically been shunned for production environments since interpreted
code typically runs slower then compiled machine code. To illustrate this, I would use
the analogy where if you are visiting a foreign country and you do not know the
language you would have to have every statement you spoke interpreted. You would
have to wait for your communication to be interpreted and you would have to wait for
the response to be interpreted. With a compiled program, the machine code is
directly fed into the operating system since the translation has already completed.
COMPILER BASICS
We have already spent some time discussing the compilers importance to the IDE
and comparing the compiler to a program interpreter. Compiled code is typically
saved into a file with a file extension of .exe. For some programming languages,
the .exe file is standalone and requires no other programs or libraries for program
execution. For other programming languages, the .exe file is designed to work with
other libraries of machine code that must exist on the computer. Most
comprehensive IDE’s include the packaging and deployment tools that will bundle all
the necessary files for the application to run on a different personal computer. This
packaging tool would not only include the IDE created .exe file that also any libraries
of machine code necessary to run that program.
Compiler: Much like the Interpreter converts computer language statements into
executable machine code, a compiler also converts source code into machine code. A
compiler converts the source code into an .EXE file that can be run by the operating
system. Compiled programs run faster than interpreted programs since the source
code to machine code conversion was done in advance and place in a file that can be
executed by the operating system.
Figure 5: Process of Creating an Executable Program with a Compiler
There are benefits in creating programs that can be executed under a virtual run-
time machine. It is now possible to compile a program in a Microsoft Windows
environment and run that same compiled file on an Apple Macintosh running the OS
10 operating system. Normally with compiled programs, it would not be possible for
the same program to run across multiple operating systems. The term “write once
run everywhere” has been used to categorize programming languages that use
virtual run-time machines. Both the Java Virtual Machine and the Common Language
Runtime have a specification that allows virtual run-time machines to be created for
not only computers but also devices like cell phones, personal digital assistants (PDA)
and even smartcards. This allows the programmer to use their personal computer to
create programs for other computing devices like cell phones and PDA’s. This is
another way of extending the productivity of the programmer.
Status Check:
The intent of this section is to introduce the new programmer to standards and
techniques frequently used by professional programmers. Topics in this section relate
to concepts introduced in the chapter but with a more vocational or occupational
focus for students considering a career in programming.
Key Concepts: Programming is a mix of using your creativity and your problem
solving skills to create something from nothing that can be admired just like we
admire good music or art.
So from one standpoint it’s important that you are able to design new program logic
and write effective programs. As a new programmer, it’s probably more important
that you are able to look at someone else’s program logic and understand how to
apply the necessary changes.
All professions have activities which are considered benchmarks for success. If you’re
a major league baseball player than your benchmark for success is probably your
batting average or the number of home runs hit. As a programmer, your benchmarks
are writing high quality programs that run with the highest standards of performance.
Your documentation and design should be clear and concise. Your knowledge of
technology is up to date and you’re committed to learning new technology as it is
developed. Peer respect on the job will come from being able to take problems and
systematically and professionally convert them into software solutions.
Programming exercises your mind and challenges you to think. Meeting that
challenge and being successful in developing solutions with a computer can be very
rewarding. If you ask any programmer how they felt about their career decision, I
think most would tell you that they have found it to be an extremely rewarding
career. Programmers are considered professional staff. As a professional, their given
a great deal of latitude to set their schedule, pick their projects and work with
minimal management supervision. Most programmers would tell you the
programming is a very good career choice.
Key Concepts: Becoming a successful programmer means that one needs to learn
the standards and best practices used by successful programmers. These practices
include learning techniques for creating program logic. Many times these best
practices are not given the appropriate attention in programming classes since
programming classes need to focus on the syntax of the language being taught. The
focus in this eBookwill be on structured an object oriented programming but the
examples and exercises will allow you to perform some programming with an easy to
use the programming language called Python. Don’t be alarmed that you are being
exposed to a programming language so soon. Python is a tool that will help you get
the kind of feedback necessary to determine if your program logic designs are
correct. It is an added bonus that we will be able to have exposure to a powerful
programming language as part of the wiki’s coverage.
TIP: Even though it is easy to ignore documentation when one is deep into coding a
program, it is much easier to place program comments in your code as you go then it
is to go back later and try to remember what was important about that part of the
program logic. There is probably no so thing as too much program documentation
unless the programming language is interpreted in which case the program
comments should be placed the end of the program after the programming language
statements.
I have included below some sample program documentation for a PYTHON program.
The # signs are used in PYTHON to add program comments to a source code. The #
sign (along with the text to the right of the #) is ignored by the interpreter and not
executed. There are typically no rules or standards regarding comments but most
programmers will usually add a sentence or two for a quick explanation.
#Gary Marrer
CHAPTER REVIEW
Chapter summary, highlights, key terms, short answer questions, quizzes and case
studies to reinforce topics covered in this chapter.
CHAPTER SUMMARY
After finishing this chapter you should understand and in some cases, demonstrate
the following topics:
Describe the relationship between computer programming logic and computer programs.
o Problems solved on the computer with computer programs first start with a plan
that is documented as logic in logic models.
Explain the process of solving a problem with program logic and a computer program.
o The process of programming requires that you (1) identify the problem, (2) model
the solution, (3) implement the solution with a programming language and (4) run
the program to derive the solution.
Describe why program logic is modeled with pseudo code and flow charts before being
transformed into a program.
o In absence of a plan to design a solution, a design leave out important details to
built the programming instructions necessary to write the program.
o SDLC has long been used to guide systems staff through a systematic process
for problem management. With SDLC the process phases are defined as
planning, requirements analysis, design, development, implementation and
maintenance.
Describe the roles and responsibilities of programmers and the processes programmers
use to create programs.
o Programmers write programs and are an important part of very organization and
recognized as a professional with limited need for direct management
Compiler
Debugger
Interpreters
Program Documentation
Programmer
Programming Languages
Pseudo Code