Essays /

Note Essay

Essay preview

Part 1 Introduction to Programming
Chapter 1 Understanding Program Logic and Programming
 
In this chapter, you will learn how to:
 
1. Define the meaning program logic and a computer program. 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. 5. Recognize the importance of program development methodologies like the program development process and the system development life cycle to develop computer 6. Describe the roles and responsibilities of programmers and the processes programmers use to create programs. 7. Differentiate between compilers, interpreters and virtual run-time machines in regards to building and executing programs.  

 
Welcome to Computer Programming
 
I would like to officially welcome you to computer programming. I am excited that you have selected this eBookto learn how to develop your own computer programs. I will give you all the information and examples necessary to understand the basics of computer programming. I will use standardized programming techniques and tools which have long been used by programmers to create quality computer applications. I will incorporate common sense explanations with a variety of examples to make sure the theory is backed up with application of that theory.  

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…..  

 
Computer Programming – Computer programming is an activity performed by a computer programmer. It always starts with a person. It includes a process of creating logic models which is converted into program language instructions that are later executed on a computer. The goal of the program is to solve a problem or perform a task. Like a recipe provides instructions for a cook, a computer program provides instructions for the computer. Program Logic – Program logic is used by programmers to model the programming language instructions carried out by the computer when the program is executed. Think of program logic as instructions you might give someone on how to make something or perform a task they have never done before. Program logic structure instructions might provide a program decision (i.e. if file does not exist, display message) or a loop through a series of repeated instructions. You might also think of your logic model as a blue print where you have mapped out the instructions but have yet to put them in a program as program language statements.  

Programming Language Statements: Programming language statements are used to implement program logic by sending instructions to the operating system. is logic with a program built on program language statements. Programming Tip: Logic models are programming language independent which means logic writing concepts in the eBookcan be used across all programming languages.  

 
Figure 1: A Computer Program and its Parts
 
A Disciplined Approach to Programming
 
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 Process of Programming
 
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 Basic.Net, C++, C# or Java).  

 
Key Concept: A program is the implementation of your program logic with programming language statements. Program logic and programming come together like a pilot and his airplane. Each by themselves offers little but together, they can provide much more. In short, programming logic is your plan for solving a problem and the program is the implementation of our program logic with programming language statements.  

Program Language Statements - Program language statements are English like statements that when executed in the correct sequence can instruct the computer to perform a series of tasks. There are many computer programming languages each having differences and similarities. The differences allow some programming languages to work with some computer applications better than others (i.e. the COBOL computer language has long been a favorite of business programmers.  

A First Look: Understanding Programming Process
 
 
We must start our understanding of programming by dispelling a few computer myths. Many of us have grown up with a “Hollywood view” of computers. That view has presented the computer as some sort of super brain. A device that we need only ask questions of and it will return to us knowledge we don’t possess. A machine that can reason, learn or acquire intelligence on its own.  

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.  

 
Pseudo Code: Pseudo code is a nonstandard English-like programming language used by programmers to model logic and instructions. Pseudo code is called a programming language even through it can not be excluded by a computer. It is designed for planning purposes only. By nonstandard, if you open five books on programming, all would have pseudo code examples but all of those examples would look somewhat different. Most computer languages have required standards that must be followed when creating programs. Pseudo code provides us with a way to concentrate on just logic structures without be constrained by the syntax rules of a particular programming language.   

 
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 other...

Read more

Keywords

000 1 10 10.00 15 1998 2 2.00 20 25 3 30 35 4 5 6 7 750 9 a.m abid abil abl absenc accent accept access accomplish account acquir across act action activ actual ad add addit address admir admit advanc advantag affect agenc airplan alarm allow along alreadi also altern although alway amount analog analysi analyz anoth answer anyth apologet appl appli applic appreci approach appropri approxim architect area aren around arriv art asid ask assembl assess asset assign assist associ assum assur attach attack attent audio author automat avail averag b back background bar base basebal basi basic basic.net bat beauti becom began begin beginn behind benchmark benefit best better binari blame block blue blueprint bonus book bookstor box brain bread break bug build builder built bulk bundl busi butter buy c cactus calcul call came cannot capabl captur car career carpent carri case categor caught caus cbt cd cd-rom ceil cell central certain challeng chanc chang chapter chart chavez check checklist chip chocol choic christina class classif clear clockwis close clr cobol code coffe coin colon column combin come comment commit common communic compani compar compet competit competitor compil complet complex complic composit comprehens comput concentr concept conceptu concern concert concis conclus condit configur confus connect consid consider consist constrain constraint construct contain contemporari continu contract control convers convert cook cooki correct cost could count counter counter-clockwis countri cover coverag creat creation creativ credit critic cup current custom cycl daili data date daughter day deal debug debugg decid decis declar dedic deep deeper defin definit deliv demonstr depart depend deploy deriv describ design desktop detail determin develop devic diagram differ differenti difficult difficulti digit direct disciplin discuss dispel display displeasur dispos dissatisfact distanc distribut document doesn dollar domain done door dough drive driven earli earlier eas easi easier easili ebooka ebookalong ebookand ebookar ebookbut ebookcan ebooki ebookto ebookwa ebookwil edit editor educ effect effici effort either electr electrician els emphasi employ employe empti encount end english english-lik enjoy enough ensur entir entri environ equal error especi etc evalu even event ever everi everyth everywher evid exact examin exampl exceed excel excit exclud excus exe execut exercis exist expand expens experi experienc expertis explain explan expos exposur express extend extens extrem face facilit fact fail fall familiar far farther faster fault favor favorit featur fed feedback feet felt fictiti fifteen figur file final find finish first fit five fix flag flat flew flexibl floor flow flowchart focus follow fond food foreign foremost forget forgot form formal format formul found foundat four fourth french frequent front frustrat ft full function fundament gari general generic get girl give given go goal goe good grade grammar graphic great ground group grow grown growth guid gun gypsi habit handl happen happi hardwar held help high higher highest highlight hire histori hit hold hollywood home hope hour hous howev html human hundr i.e icon ide ideal identifi ignor illustr implement import impos improv includ incorpor incorrect increas independ individu industri inform ingredi initi input insect insert instal instead instruct integr intellig intens intent intermedi internet interpret interview intimid intranet/internet introduc introduct introductori inventori invest invoic involv isol item jar java job join jvm keep kept key keyword kind kitchen knife know knowledg known labor lack languag laps larg last later latitud launch lay leader leagu learn leav lengthen less let letter level lf librari lid liek life like limit line link linux list littl live ll local locat logic loi long look loop loos lose lot low lower loyal machin macintosh made magnitud main maintain mainten major make mall manag mani manipul manufactur map marrer materi math matrix matter maxim may mayb mean mechan meet mention menu messag methodolog methodology/process microsoft might mind mine minim minimum minut misconcept miss mistak mistaken mix model modern modif modifi modul month moth move msg much multipl music must myth name natur near necessari necessarili need needless neglect neither net network never new next non non-comput nonstandard normal note noth notic number object observ occas occup occur offer offic offici often old older omit on-go on-lin one open oper opportun optim option order organ orient origin os other outlin outsid outsourc oven overal owner p.m packag page pantri paragraph parallel part particip particular partnership passion past pattern payabl payment payrol pc pda pdp peak peanut peer penalti peopl per perform perhap person phase phone pick pictur piec pilot place placement plan plastic platform player plumber point popular possess possibl potenti power practic practition pre pre-compil preced prepar prerequisit present previous pride primarili print priorit prioriti probabl problem process produc product profess profession profit program programm progress project provid prudent pseudo public purpos put putter python qualiti question questionnair quick quicker quit quizz rather re reach read readi real realiti reason receiv recent recip recogn recogniz record reduc refer referenc reflect refriger regard regul reinforc reject relat relationship remain rememb remov rental repair repeat replac report repres reput request requir research resourc respect respons rest result retail return reus reusabl review revisit reward rifl right robot role rom roof room routin row rub rule run run-tim runnabl runtim salari sale sampl sandwich save saw say scenario schedul scienc scientif score scout scratch sdlc search second secret section see seem seen select self self-docu self-help sell seller semi send sens sentenc separ sequenc sequenti seri servic set sever sharehold sharp shelf shelv shift short shot shot-gun shown shrink shun sign silent similar simpl simplest simplic sinc singl sister situat size skill slight slower small smart smartcard soften softwar sold solut solv someon someth sometim somewhat somewher soon sooner sophist sort sound sourc space spanish speak special specif spend spent spirit spoke spread spreadsheet squar staff stand standalon standard standpoint stare start statement status step still stop store straightforward street stress strip strong structur stud student studi studio.net style sub sub-process subject subtract success suggest summari super supercomput supervis suppli support sure symbol syntax system systemat tackl tag take taken talk tape task taught tea teach team techniqu technolog tell temperatur term test text textbook theme theori thing think third though threaten three throughout tie time tip tire today togeth told tool toolbox topic track tradit traffic train training/documentation transform translat trend tri tricki troop troubleshoot true truest truli truth tube turn turnaround twenti two type typic uml understand understood unfortun unifi uniqu unit unless unnatur unorgan unusu updat upgrad us use user usual vacuum valid valu variabl varieti various ve version versus via view virtual visit visual vocat volum wait wall want wasn waterfal way weak web week welcom went whenev wherea wiki will window within without word work worri would wrap write written xp year yes yet youngest zero