Preserve speed with the fast-developing international of working structures Open-source working structures, digital machines, and clustered computing are one of the top fields of working platforms and networking which are swiftly altering. Show sample text content. Skip to content. With an interpretive language, you must have thelanguage to run the program. For many years, the principle goal of computer programmers was to write short pieces of code thatwould execute quickly. The program needed to be small, because memory was expensive, and it neededto be fast, because processing power was also expensive.
As computers have become smaller, cheaper,and faster, and as the cost of memory has fallen, these priorities have changed. Today the cost of aprogrammers time far outweighs the cost of most of the computers in use by businesses. Well-written, Easy- to-maintain means that as business requirements change,the program can be extended and enhanced without great expense.
ProgramsThe word program is used in two ways: to describe individual instructions, or source code, created bythe programmer, and to describe an entire piece of executable software. This distinction can causeenormous confusion, so we will try to distinguish between the source code on one hand, and theexecutable on the other.
SAMS TEACH YOURSELF C++ IN 21 DAYS
New Term: A program can be defined as either a set of written instructions created by aprogrammer or an executable piece of software. Source code can be turned into an executable program in two ways: Interpreters translate the sourcecode into computer instructions, and the computer acts on those instructions immediately.
Alternatively,compilers translate source code into a program, which you can run at a later time. While interpreters areeasier to work with, most serious programming is done with compilers because compiled code runsmuch faster. Solving ProblemsThe problems programmers are asked to solve have been changing.
Sams Teach Yourself C++ in 21 Days
Twenty years ago, programs werecreated to manage large amounts of raw data. The people writing the code and the people using theprogram were all computer professionals. Today, computers are in use by far more people, and mostknow very little about how computers and programs work.
- Sams Teach Yourself C++ in One Hour a Day, Siddhartha Rao Paperback!
- Top Authors;
- Legions of Light: Episode I!
- Sams Teach Yourself C++ In One Hour A Day.
- The Book of Snobs.
Computers are tools used by people who aremore interested in solving their business problems than struggling with the computer. Ironically, in order to become easier to use for this new audience, programs have become far moresophisticated. Gone are the days when users typed in cryptic commands at esoteric prompts, only to seea stream of raw data.
Todays programs use sophisticated "user-friendly interfaces," involving multiplewindows, menus, dialog boxes, and the myriad of metaphors with which weve all become familiar. Theprograms written to support this new approach are far more complex than those written just ten yearsago. As programming requirements have changed, both languages and the techniques used for writingprograms have evolved.
While the complete history is fascinating, this book will focus on thetransformation from procedural programming to object-oriented programming. Procedural, Structured, and Object-Oriented Programming Until recently, programs were thought of as a series of procedures that acted upon data. A procedure, orfunction, is a set of specific instructions executed one after the other. The data was quite separate fromthe procedures, and the trick in programming was to keep track of which functions called which otherfunctions, and what data was changed.
To make sense of this potentially confusing situation, structuredprogramming was created. The principle idea behind structured programming is as simple as the idea of divide and conquer. Acomputer program can be thought of as consisting of a set of tasks. Any task that is too complex to bedescribed simply would be broken down into a set of smaller component tasks, until the tasks weresufficiently small and self-contained enough that they were easily understood. As an example, computing the average salary of every employee of a company is a rather complex task.
You can, however, break it down into these subtasks Find out what each person earns. Count how many people you have. Total all the salaries. Divide the total by the number of people you have. Totaling the salaries can be broken down into1. Get each employees record. Access the salary. Add the salary to the running total. Get the next employees record. In turn, obtaining each employees record can be broken down into1.
Open the file of employees. Go to the correct record. Read the data from disk. Structured programming remains an enormously successful approach for dealing with complexproblems. By the late s, however, some of the deficiencies of structured programing had became alltoo clear. First, it is natural to think of your data employee records, for example and what you can do with yourdata sort, edit, and so on as related ideas. Second, programmers found themselves constantly reinventing new solutions to old problems.
This isoften called "reinventing the wheel," and is the opposite of reusability. The idea behind reusability is tobuild components that have known properties, and then to be able to plug them into your program as youneed them.
SAMS TEACH YOURSELF C++ IN 21 DAYS
This is modeled after the hardware world--when an engineer needs a new transistor, shedoesnt usually invent one, she goes to the big bin of transistors and finds one that works the way sheneeds it to, or perhaps modifies it. There was no similar option for a software engineer. New Term: The way we are now using computers--with menus and buttons and windows--fosters a more interactive, event-driven approach to computer programming.
Event-driven meansthat an event happens--the user presses a button or chooses from a menu--and the program mustrespond.
From the publisher:
Programs are becoming increasingly interactive, and it has became important to designfor that kind of functionality. Old-fashioned programs forced the user to proceed step-by-step through a series of screens. Modernevent-driven programs present all the choices at once and respond to the users actions.
Object-oriented programming attempts to respond to these needs, providing techniques for managingenormous complexity, achieving reuse of software components, and coupling data with the tasks thatmanipulate that data. The essence of object-oriented programming is to treat data and the procedures that act upon the data asa single "object"--a self-contained entity with an identity and certain characteristics of its own.
Encapsulation and DataHiding When an engineer needs to add a resistor to the device she is creating, she doesnt typically builda new one from scratch. She walks over to a bin of resistors, examines the colored bands that indicatethe properties, and picks the one she needs. The resistor is a "black box" as far as the engineer isconcerned--she doesnt much care how it does its work as long as it conforms to her specifications; shedoesnt need to look inside the box to use it in her design.
The property of being a self-contained unit is called encapsulation. With encapsulation, we canaccomplish data hiding. Data hiding is the highly valued characteristic that an object can be used withoutthe user knowing or caring how it works internally. Just as you can use a refrigerator without knowinghow the compressor works, you can use a well-designed object without knowing about its internal data Similarly, when the engineer uses the resistor, she need not know anything about the internal state of theresistor.
All the properties of the resistor are encapsulated in the resistor object; they are not spread outthrough the circuitry. It is not necessary to understand how the resistor works in order to use iteffectively. Its data is hidden inside the resistors casing. Youll see how to create classes on Day 6, "Basic Classes. The actual inner workings of the classshould be hidden.