Web site designers - 282 Object-Based Programming Chapter 8 principle is called

282 Object-Based Programming Chapter 8 principle is called information hiding). Although some objects can communicate with one another across well-defined interfaces (just like the driver s interface to a car includes a steering wheel, accelerator pedal, brake pedal and gear shift), objects are unaware of how other objects are implemented (just as the driver is unaware of how the steering, engine, brake and transmission mechanisms are implemented). Normally, implementation details are hidden within the objects themselves. Surely, it is possible to drive a car effectively without knowing the details of how engines, transmissions and exhaust systems work. Later, we will see why information hiding is so crucial to good software engineering. In procedural programming languages (like C), programming tends to be action oriented. C# programming, however, is object oriented. In C, the unit of programming is the function (functions are called methods in C#). In C#, the unit of programming is the class. Objects eventually are instantiated (i.e., created) from these classes and functions are encapsulated within the boundaries of classes as methods. C programmers concentrate on writing functions. They group actions that perform some task into a function and then group functions to form a program. Data are certainly important in C, but they exist primarily to support the actions that functions perform. The verbs in a system-requirements document describing the requirements for a new application help a C programmer determine the set of functions that will work together to implement the system. By contrast, C# programmers concentrate on creating their own user-defined types, called classes. We also refer to classes as programmer-defined types. Each class contains both data and a set of methods that manipulate the data. The data components, or data members, of a class are called member variables, or instance variables (many C# programmers prefer the term fields).1 Just as we call an instance of a built-in type such as int a variable, we call an instance of a user-defined type (i.e., a class) an object. In C#, attention is focused on classes, rather than on methods. The nouns in a system-requirements document help the C# programmer determine an initial set of classes with which to begin the design process. Programmers use these classes to instantiate objects that work together to implement the system. This chapter explains how to create and use classes and objects, a subject known as object-based programming (OBP). Chapters 9 and 10 introduce inheritance and polymorphism key technologies that enable object-oriented programming (OOP). Although we do not discuss inheritance in detail until Chapter 9, it is part of several class definitions in this chapter and has been used in several examples previously. For example, in the program of Section 4.13 (and several subsequent programs), we inherited a class from System.Win- dows.Forms.Form to create an application that executes in its own window. Software Engineering Observation 8.1 All C# objects are passed by reference. 8.2 Implementing a Time Abstract Data Type with a Class Classes in C# facilitate the creation of abstract data types (ADT), which hide their implementation from clients (or users of the class object). A problem in procedural programming 1. We sometimes use industry-standard terminology, such as data members and instance members. rather than C# terms such as fields, For a listing of C#-specific terminology, please see the C# Language Specification, which can be downloaded from msdn.microsoft.com/vstudio/ nextgen/technology/csharpdownload.asp.
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Leave a Reply