An Overview of Computers and Programming 1 Understanding Computer Systems Computer system • Combination of all the components required to process and store data using a computer • Made up of • Hardware • Software Hardware • Equipment associated Software • Computer instructions • Tells the hardware what to do • Named Programs 2 Programs Instructions written by programmers Application System software such software as word programs processing, managing spreadsheets, operating payroll and systems like inventory, Windows, even games Linux, or UNIX Computer hardware and software manage three major operations : Input Data items such as text, numbers, images, and sound Processing Calculations and comparisons performed by the central processing unit (CPU) Output Resulting information that is sent to a printer, a monitor, or storage devices after processing Computer Terminology Programming language Syntax • Used to write computer instructions (program code) • Examples • Visual Basic, C#, C++, or Java • Rules governing word usage and punctuation Computer memory Permanent storage devices • Computer’s temporary, internal storage – random access memory (RAM) • Volatile memory – lost when the power is off • • • • Nonvolatile memory Hard drives Flash drives CD Computer Terminology Compiler or interpreter • Translates source code into machine language (binary language) statements called object code • Checks for syntax errors Program executes or runs • Input will be accepted, some processing will occur, and results will be output Users or end users Documentation • People for whom a program is written • Supporting paperwork for a program Computer Terminology Syntax errors Logical errors • Programs with syntax errors cannot execute • Errors in program logic produce incorrect output Logic of the computer program Variable • Sequence of specific instructions in specific order • Named memory location whose value can vary Program Development Understand the problem Plan the logic Code the program Use software (a compiler or interpreter) to translate the program into machine language Test the program Put the program into production Maintain the program Understanding the Problem Print a list of all employees who have been here for over five years Does the director want a list of full-time employees only, or a list of full- and part-time employees together? Does she want to include people who have worked for the company on a month-to-month contractual basis over the past five years, or only regular, permanent employees? Do the listed employees need to have worked for the organization for five years as of today, as of the date of the dinner, or as of some other cutoff date? What about an employee who worked three years, took a two-year leave of absence, and has been back for three years? What data should be included for each listed employee? Should the list contain both first and last names? Social Security numbers? Phone numbers? Addresses? Should the list be in alphabetical order? Employee ID number order? Length-ofservice order? Some other order? 9 Planning the Logic n n Heart of the programming process Most common planning tools – – – – n Flowcharts Pseudocode IPO charts (input, processing, and output) TOE charts (tasks, objects, and events) Desk-checking – Walking through a program’s logic on paper before you actually write the program 10 Code the Program n Hundreds of programming languages available – Choose based on features – Similar in their basic capabilities n Easier than the planning step 11 Using Software to Translate the Program into Machine Language n Translator program – Compiler or interpreter – Changes the programmer’s English-like highlevel programming language into the low-level machine language n Syntax error – Misuse of a language’s grammar rules – Programmer corrects listed syntax errors – Might need to recompile the code several times 12 Using Software to Translate the Program into Machine Language 13 Testing the Program n Logical error – Results when a syntactically correct statement, but the wrong one for the current context, is used n Test – Execute the program with some sample data to see whether the results are logically correct n n Debugging is the process of finding and correcting program errors Programs should be tested with many sets of data 14 Putting the Program into Production Process depends on program’s purpose • May take several months The entire set of actions an organization must take to switch over to using a new program or set of programs 15 Maintaining the Program Maintenance • Making changes after the program is put into production Common first programming job • Maintaining previously written programs Make changes to existing programs • Repeat the development cycle 16 Understanding Programming and User Environments Many options for programming and user environments : Planning • Flowchart • Pseudocode Coding • Plain text editor • Text editor that is part of an integrated development environment (IDE) Executing • Input from keyboard, mouse, microphone Outputting • Text, images, sound Understanding Programming Environments (continued) 18 Understanding User Environments • Command line • Location on your computer screen where you type text entries to communicate with the computer’s operating system • Graphical user interface (GUI) • Allows users to interact with a program in a graphical environment Understanding User Environments (continued) 20 Understanding User Environments (continued) 21 Understanding the Evolution of Programming Models n n People have been writing modern computer programs since the 1940s Newer programming languages – Look much more like natural language – Are easier to use – Create self-contained modules or program segments that can be pieced together in a variety of ways 22 Major models or paradigms used by programmers Understanding the Evolution of Programming Models Procedural programming Focuses on the procedures that programmers create Object-oriented programming Focuses on objects, or “things,” and describes their features (or attributes) and their behaviors 23 Review - True or False n n n n n n n n n n n n n n n Hardware is the equipment, or the devices, associated with a computer. Software is computer instructions. The grammar rules of a computer programming language are its syntax. You write programs using machine language, and translation software converts the statements to a programming language. The oldest computer programs were written in many separate modules. Procedural programmers focus on actions that are carried out by a program. Object-oriented programmers focus on a program’s objects and their attributes and behaviors. You can type a program into an editor that is part of an integrated development environment, but using a plain text editor provides you with more programming help. When a program runs from the command line, a user types text to provide input. Although GUI and command-line environments look different, the logic of input, processing, and output apply to both program types. Understanding the problem that must be solved can be one of the most difficult aspects of programming. The two most commonly used logic-planning tools are flowcharts and pseudo code. Flowcharting a program is a very different process if you use an older programming language instead of a newer one. A program with syntax errors can execute but might produce incorrect results. Although the syntax of programming languages differs, the same program logic can be expressed in different languages. Most simple computer programs include steps that perform input, processing, and output.
© Copyright 2022 Paperzz