The concept of object-oriented programming had its roots in SIMULA 67 but was not fully developed until the evolution of Smalltalk resulted in Smalltalk 80 (in 1980, of course). Indeed, some consider Smalltalk to be the base model for a purely objectoriented programming language. A language that is object oriented must provide support for three key language features: abstract data types, inheritance, and dynamic binding of method calls to methods. Abstract data types were discussed in detail in Chapter 11, so this chapter focuses on inheritance and dynamic binding.

 

There are a few principle concepts that form the foundation of object-oriented programming:

•     Object

This is the basic unit of object oriented programming. That is both data and function that operate on data are bundled as a unit called as object.

 

 •     Class

When you define a class, you define a blueprint for an object. This doesn’t actually define any data, but it does define what the class name means, that is, what an object of the class will consist of and what operations can be performed on such an object.

There are several ways a derived class can differ from its parent. Following are the most common differences between a parent class and its subclasses:

  1. The parent class can define some of its variables or methods to have private access, which means they will not be visible in the subclass.
  2. The subclass can add variables and/or methods to those inherited from the parent class.
  3. The subclass can modify the behavior of one or more of its inherited methods. A modified method has the same name, and often the same protocol, as the one of which it is a modification.

 

 •     Abstraction

Data abstraction refers to, providing only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details.

For example, a database system hides certain details of how data is stored and created and maintained. Similar way, C++ classes provides different methods to the outside world without giving internal detail about those methods and data.

 

 •     Encapsulation

Encapsulation is placing the data and the functions that work on that data in the same place. While working with procedural languages, it is not always clear which functions work on which variables but object-oriented programming provides you framework to place the data and the relevant functions together in the same object.

 

 

 •     Inheritance

One of the most useful aspects of object-oriented programming is code reusability. As the name suggests Inheritance is the process of forming a new class from an existing class that is from the existing class called as base class, new class is formed called as derived class.

This is a very important concept of object-oriented programming since this feature helps to reduce the code size.

As a simple example of inheritance, consider the following: Suppose we have a class named Vehicles, which has variables for year, color, and make. A natural specialization, or subclass, of this would be Truck, which could inherit the variables from Vehicle, but would add variables for hauling capacity and number of wheels.

One disadvantage of inheritance as a means of increasing the possibility of reuse is that it creates dependencies among the classes in an inheritance hierarchy. This result works against one of the advantages of abstract data types, which is that they are independent of each other. Of course, not all abstract data types must be completely independent.

But in general, the independence of abstract data types is one of their strongest positive characteristics. However, it may be difficult, if not impossible, to increase the reusability of abstract data types without creating dependencies among some of them. Furthermore, in many cases, the dependencies naturally mirror dependencies in the underlying problem space.

 

 •     Polymorphism

The ability to use an operator or function in different ways in other words giving different meaning or functions to the operators or functions is called polymorphism. Poly refers to many. That is a single function or an operator functioning in many ways different upon the usage is called polymorphism.

 

 •     Overloading

The concept of overloading is also a branch of polymorphism. When the exiting operator or function is made to operate on new data type, it is said to be overloaded.

 

 –    Issues for Object-Oriented Languages

A number of issues must be considered when designing the programming language features to support inheritance and dynamic binding. Those that we consider most important are discussed in this section.

A.The Exclusivity of Objects

A language designer who is totally committed to the object model of computation designs an object system that subsumes all other concepts of type. Everything, from a simple scalar integer to a complete software system, is an object in this mind-set. The advantage of this choice is the elegance and pure uniformity of the language and its use.

The primary disadvantage is that simple operations must be done through the message-passing process, which often makes them slower than similar operations in an imperative model, where single machine instructions implement such simple operations. In this purest model of objectoriented computation, all types are classes. There is no distinction between predefined and user-defined classes. In fact, all classes are treated the same way and all computation is accomplished through message passing.

 

One alternative to the exclusive use of objects that is common in imperative languages to which support for object-oriented programming has been added is to retain the complete collection of types from a traditional imperative programming language and simply add the object typing model. This approach results in a larger language whose type structure can be confusing to all but expert users.

Another alternative to the exclusive use of objects is to have an imperative style type structure for the primitive scalar types, but implement all structured types as objects. This choice provides the speed of operations on primitive values that is comparable to those expected in the imperative model. Unfortunately, this alternative also leads to complications in the language. Invariably, nonobject values must be mixed with objects. This creates a need for so-called wrapper classes for the nonobject types, so that some commonly needed operations can be implemented as methods of the wrapper class. When such an operation is needed for a nonobject value, the value is converted to an object of the associated wrapper class and the appropriate method of the wrapper class is used. This design is a trade of language uniformity and purity for efficiency.

 

B.Single and Multiple Inheritance

Another simple issue is: Does the language allow multiple inheritance (in addition to single inheritance)? Maybe it’s not so simple. The purpose of multiple inheritance is to allow a new class to inherit from two or more classes. Because multiple inheritance is sometimes highly useful, why would a language designer not include it? The reasons lie in two categories: complexity and efficiency. The additional complexity is illustrated by several problems.

First, note that if a class has two unrelated parent classes and neither defines a name that is defined in the other, there is no problem. However, suppose a subclass named C inherits from both class A and class B and both A and B define an inheritable method named display. If C needs to reference both versions of display, how can that be done? This ambiguity problem is further complicated when the two parent classes both define identically named methods and one or both of them must be overridden in the subclass. Another issue arises if both A and B are derived from a common parent, Z, and C has both A and B as parent classes. This situation is called diamond or shared inheritance. In this case, both A and B should include Z’s inheritable variables. Suppose Z includes an inheritable variable named sum. The question is whether C should inherit both versions of sum or just one, and if just one, which one? There may be programming situations in which just one of the two should be inherited, and others in which both should be inherited.

The question of efficiency may be more perceived than real. In C++, for example, supporting multiple inheritance requires just one additional array access and one extra addition operation for each dynamically bound method call, at least with some machine architectures (Stroustrup, 1994, p. 270). Although this operation is required even if the program does not use multiple inheritance, it is a small additional cost.

The use of multiple inheritance can easily lead to complex program organizations. Many who have attempted to use multiple inheritance have found that designing the classes to be used as multiple parents is difficult. Maintenance of systems that use multiple inheritance can be a more serious problem, for multiple inheritance leads to more complex dependencies among classes. It is not clear to some that the benefits of multiple inheritance are worth the added effort to design and maintain a system that uses it.

Interfaces are an alternative to multiple inheritance. Interfaces provide some of the benefits of multiple inheritance but have fewer disadvantages.

C.Allocation and Deallocation of Objects

There are two design questions concerning the allocation and deallocation of objects. The first of these is the place from which objects are allocated. If they behave like the abstract data types, then perhaps they can be allocated from anywhere. This means they could be allocated from the run-time stack or explicitly created on the heap with an operator or function, such as new. If they are all heap dynamic, there is the advantage of having a uniform method of creation and access through pointer or reference variables. This design simplifies the assignment operation for objects, making it in all cases only a pointeror reference value change. It also allows references to objects to be implicitlydereferenced, simplifying the access syntax.

If objects are stack dynamic, there is a problem with regard to subtypes. If class B is a child of class A and B is a subtype of A, then an object of B type can be assigned to a variable of A type. For example, if b1 is a variable of B type and a1 is a variable of A type, then a1 = b1; is a legal statement. If a1 and b1 are references to heap-dynamic objects, there is no problem—the assignment is a simple pointer assignment. However, if a1 and b1 are stack dynamic, then they are value variables and, if assigned the value of the object, must be copied to the space of the target object. If B adds a data field to what it inherited from A, then a1 will not have sufficient space on the stack for all of b1. The excess will simply be truncated, which could be confusing to programmers who write or use the code. This truncation is called object slicing. The following example illustrates the problem.

class A { int x;

. . .

}; class B : A { int y;

. . .

}

The second question here is concerned with those cases where objects are allocated from the heap. The question is whether deallocation is implicit, explicit, or both. If deallocation is implicit, some implicit method of storage reclamation is required. If deallocation can be explicit, that raises the issue of whether dangling pointers or references can be created.

 

D.Dynamic and Static Binding

As we have discussed, dynamic binding of messages to methods is an essential part of object-oriented programming. The question here is whether all binding of messages to methods is dynamic. The alternative is to allow the user to specify whether a specific binding is to be dynamic or static. The advantage of this is that static bindings are faster. So, if a binding need not be dynamic, why pay the price?

 

 

E.Nested Classes

One of the primary motivations for nesting class definitions is information hiding. If a new class is needed by only one class, there is no reason to define it so it can be seen by other classes. In this situation, the new class can be nested inside the class that uses it. In some cases, the new class is nested inside a subprogram, rather than directly in another class.

The class in which the new class is nested is called the nesting class. The most obvious design issues associated with class nesting are related to visibility. Specifically, one issue is: Which of the facilities of the nesting class are visible in the nested class? The other main issue is the opposite: Which of the facilities of the nested class are visible in the nesting class?

 

–    Support for Object-Oriented Programming in C++

C++ evolved from C and SIMULA 67, with the design goal of support for object-oriented programming while retaining nearly complete backward compatibility with C. C++ classes, as they are used to support abstract data types. C++ support for the other essentials of object-oriented programming is explored in this section. The whole collection of details of C++ classes, inheritance, and dynamic binding is large and complex. This section discusses only the most important among these topics, specifically, those directly related to the design issues.

C++ was the first widely used object-oriented programming language, and is still among the most popular. So, naturally, it is the one with which other languages are often compared. For both of these reasons, our coverage of C++ here is more detailed than that of the other example languages.

Tags:

HTTP 2016

Posted in: Uncategorized by tommyphen on September 21, 2016

HTTP

HTTP(HIMTI Togetherness and Top Performances) adalah acara yang diselenggarakan oleh HIMTI (Himpunan Mahasiswa Teknik Informatika) yang dibuat khusus untuk para mahasiswa baru School of Computer Science. Pada HTTP 2016 yang bertemakan Passion, Innovation & Togetherness ini. Mahasiswa dapat membayar Rp 150.000,00 untuk dapat mengikuti acara HTTP yang diadakan di Gedung BPPT II pada hari sabtu, 10 September 2016 dari jam 09.00 sampai acara selesai. Tidak hanya itu, para mahasiswa baru diberikan berbagai benefit yang dapat membantu dalam menjalani masa perkuliahan di BINUS University, yaitu:

  • PBC(Pengenalan Bahasa C)
  • HIMTI Exclusive Pin
  • Merchandise
  • Point SAT
  • e-Certificate
  • HIMTI Kit 2016

1474369815217

1474369820532

Kemudian pada HTTP ini terdapat berbagai performances, yaitu:

  • Terdapat IT showcase yang menunjukkan game dan aplikasi karya mahasiswa SoCS
  • Peanut Butter Band
  • Dilanjutkan dengan sambutan dari MC dan sambutan Ketua HIMTI Kemanggisan Jonathan Gozali dan Alam Sutera Rionaldo Aureri Linggautama serta Dekan Fredy Purnomo, S.Kom., M.Kom dan Dosen IT BINUS University dan Wakil Rektor Andreas Chang.
  • Penyanyi Adam Sidqon yang membawakan beberapa lagu.
  • Games 1: Sambung menyambung kata. Dimainkan oleh 6 orang dengan menyambung kata dan  melanjutkan kata yang sudah dipakai orang lain sebelumnya.
  • Games 2: Melempar bola ping-pong. Dimainkan berpasangan dengan total 3 tim , kemudian pemain melempar bola ke keranjang yang dipasang pada kepala pemain lain dan saling bertukaran sama mendapat pemenang dengan poin terbanyak.
  • Talkshow dengan Christian Tarunajaya, Reinhard Lazuardi Kuwandy dan Natanael Febrianto
  • Lunch dan istirahat
  • Pertunjukan dance dari anggota Revolution
  • Visualisasi HTTP dari anggota-anggota HIMTI yang menggambarkan perkuliahan mulai dari FEP hingga menjadi aktivis HIMTI
  • Pertunjukan dance para aktivis-aktivis HIMTI
  • Terdapat Guest Star yaitu Vibing High dan juga DJ Angelo unutk menutupi acara HTTP 2016 ini
  • Pembagian Merchandise, HIMTI kit dan baju desain buatan HIMTI untuk para mahasiswa baru.

Jpeg

1474369832731

 

Sekian artikel ini mengenai acara HTTP 2016 ini. Semoga bermanfaat bagi pembaca, Terima Kasih .

 

One Family,One Goal

 

Tags:

Hello world!

Posted in: Uncategorized by tommyphen on September 20, 2016

Welcome to Binusian blog.
This is the first post of any blog.binusian.org member blog. Edit or delete it, then start blogging!
Happy Blogging 🙂

Tags: