http://web.mit.edu/physics/
http://ocw.mit.edu/OcwWeb/Physics/index.htm
&
Aeronautics and Astronautics Engineering
http://web.mit.edu/aeroastro/www/
http://ocw.mit.edu/OcwWeb/Aeronautics-and-Astronautics/index.htm
Harvard-MIT Division of Health Sciences and Technology links
Visit the Harvard-MIT Division of Health Sciences and Technology home page at:
http://hst.mit.edu/
Review the Harvard-MIT Division of Health Sciences and Technology curriculum at:
http://ocw.mit.edu/OcwWeb/web/resources/curriculum/index.htm#HST
OBJECT-ORIENTED PROGRAMMING
Mata kuliah yang membahas pemrograman berorientasi objek (object-oriented programming (OOP)) dengan bahasa pemrograman Java. Materi disajikan dengan metode perimbangan teori-praktek, dengan harapan bahwa mahasiswa disamping memahami konsep dan paradigma berorientasi objek, juga memiliki skill pemrograman di level dasar-intermediate. Untuk itu mahasiswa yang mengikuti mata kuliah ini diharapkan membawa laptop di kelas. Materi akan diperkaya dengan berbagai studi kasus dan penugasan membuat program Java berbasis text dan GUI.
Mahasiswa yang mengikuti mata kuliah ini harus menyelesaikan seluruh tugas dan ujian, karena nilai akhir adalah nilai total dari berbagai tugas dan ujian. Jangan lupa untuk mengupdate data pribadi, khususnya di bagian nama lengkap, nama universitas dan nomor induk mahasiswa.
(Disalin dari perkuliahan online Bpk. Romi Satria Wahono, B.Eng., M.Eng., D.Eng.)
Contents
1. OOP CONCEPTS
Pada bagian ini akan dibahas tentang konsep-konsep dan karakteristik dari pemrograman berorientasi objek (OOP). Pembahasan akan diawali dengan konsep pemrograman, paradigma, dan tool pemrograman. Kemudian akan dibahas konsep dasar dan lanjut dari pemrograman berorientasi objek.
- Materi Utama:
- OOP Concepts (Romi Satria Wahono)PDF document
Materi Referensi:- Bahasa dan Lingkungan Pemrograman (JENI)PDF document
- Getting Started with Java (Rogers Cadenhead)PDF document
- Class, Object and Method (Rogers Cadenhead)PDF document
Link Referensi:- Object-Oriented Programming (Wikipedia)file
- Object-Oriented Programming Concepts (Java Tutorial)file
Tugas:- Tugas Membuat Artikel Blog tentang Konsep OOP
Pada bagian ini akan dibahas tentang dasar-dasar pemrograman Java. Pembahasan meliputi: pernyataan, ekspresi, variabel, tipe data, literal, array, operator, pernyataan penentu keputusan dan pernyataan pengulangan proses.
- Materi Utama:
- Java Fundamentals (Romi Satria Wahono)PDF document
Materi Referensi:- Dasar Pemrograman Java (JENI)PDF document
- Java Basic (Rogers Cadenhead)PDF document
Link Referensi:- Java Language Basics (Java Tutorial)file
Tugas:- Tugas Membuat Program Perpustakaan Sederhana
3. JAVA ADVANCED
Pada bagian ini akan dibahas tentang pemrograman Java untuk tingkat lanjut. Pembahasan meliputi: penanganan eksepsi, multithreading, I/O stream, operasi berhubungan dengan file dan direktori, dan yang terakhir terntang berbagai class penting yang ada di Java API
- Materi Utama:
- Java Advanced (Romi Satria Wahono)PDF document
Materi Referensi:- Eksepsi, Thread dan IO Stream (JENI)PDF document
- Exceptions, Thread and IO Stream (Rogers Cadenhead)PDF document
Link Referensi:- Java Essential Class (Java Tutorial)
4. JAVA GUI
Pada bagian ini akan dibahas tentang pemrograman Java berbasis Graphical User Interface (GUI), khususnya menggunakan Swing. Pembahasan meliputi: konsep GUI di Java, komponen dasar Swing, penanganan kejadian (event handling) untuk GUI dan bagaimana membuat program GUI dengan Netbeans.
- Materi Utama:
- Java GUI (Romi Satria Wahono)PDF document
Materi Referensi:- Java GUI (JENI)PDF document
- Java Swing (Rogers Cadenhead)PDF document
Link Referensi:- Creating GUI with Swing (Java Tutorial)file
Tugas:- Tugas Membuat MatematikaGUI atau PerpustakaanGUI
5. JAVA GUI WITH NETBEANS
Bagian ini melanjutkan pembahasan Java GUI, dengan penekanan pada bagaimana mengembangkan aplikasi GUI dengan menggunakan IDE Netbeans. Contoh, studi kasus dan latihan diperbanyak dengan harapan mahasiswa mahir mengembangkan aplikasi desktop berbasis GUI dengan menggunakan Java.
- Materi Utama:
- Java GUI with Netbeans (Romi Satria Wahono)
Bagian ini membahas tentang algoritma dengan menggunakan bahasa Java.
7. JAVA DATABASE
Bagian ini membahas tentang teknik membuat aplikasi Java dengan koneksi ke database
8. JAVA AI
Bagian ini membahas tentang teknik menerapkan konsep kecerdasan buatan atau artificial intelligence (AI) ke dalam bahasa Java.
9. CERTIFICATE OF ACHIEVEMENT
Bagi yang sudah menyelesaikan pembelajaran dan berhasil mendapatkan nilai (grade) minimal C, silakan request Certificate of Achievement melalui fitur di bawah.
Fundamental concepts and features
A survey by Deborah J. Armstrong [2] of nearly 40 years of computing literature identified a number of "quarks", or fundamental concepts, found in the strong majority of definitions of OOP. They are the following:
- Class
- Defines the abstract characteristics of a thing (object), including the thing's characteristics (its attributes, fields or properties) and the thing's behaviors (the things it can do, ormethods, operations or features). One might say that a class is a blueprint or factory that describes the nature of something. For example, the class
Dog
would consist of traits shared by all dogs, such as breed and fur color (characteristics), and the ability to bark and sit (behaviors). Classes provide modularity and structure in an object-oriented computer program. A class should typically be recognizable to a non-programmer familiar with the problem domain, meaning that the characteristics of the class should make sense in context. Also, the code for a class should be relatively self-contained (generally using encapsulation). Collectively, the properties and methods defined by a class are called members. - Object
- A pattern (exemplar) of a class. The class of
Dog
defines all possible dogs by listing the characteristics and behaviors they can have; the objectLassie
is one particular dog, with particular versions of the characteristics. ADog
has fur;Lassie
has brown-and-white fur. - Instance
- One can have an instance of a class or a particular object. The instance is the actual object created at runtime. In programmer jargon, the
Lassie
object is an instance of theDog
class. The set of values of the attributes of a particular object is called its state. The object consists of state and the behaviour that's defined in the object's class. - Method
- An object's abilities. In language, methods (sometimes referred to as "functions") are verbs.
Lassie
, being aDog
, has the ability to bark. Sobark()
is one ofLassie
's methods. She may have other methods as well, for examplesit()
oreat()
orwalk()
orsave_timmy()
. Within the program, using a method usually affects only one particular object; allDog
s can bark, but you need only one particular dog to do the barking. - Message passing
- "The process by which an object sends data to another object or asks the other object to invoke a method." [2] Also known to some programming languages as interfacing. For example, the object called
Breeder
may tell theLassie
object to sit by passing a "sit" message which invokes Lassie's "sit" method. The syntax varies between languages, for example:[Lassie sit]
in Objective-C. In Java, code-level message passing corresponds to "method calling". Some dynamic languages use double-dispatch or multi-dispatch to find and pass messages. - Inheritance
- "Subclasses" are more specialized versions of a class, which inherit attributes and behaviors from their parent classes, and can introduce their own.
- For example, the class
Dog
might have sub-classes calledCollie
,Chihuahua
, andGoldenRetriever
. In this case,Lassie
would be an instance of theCollie
subclass. Suppose theDog
class defines a method calledbark()
and a property calledfurColor
. Each of its sub-classes (Collie
,Chihuahua
, andGoldenRetriever
) will inherit these members, meaning that the programmer only needs to write the code for them once. - Each subclass can alter its inherited traits. For example, the
Collie
class might specify that the defaultfurColor
for a collie is brown-and-white. TheChihuahua
subclass might specify that thebark()
method produces a high pitch by default. Subclasses can also add new members. TheChihuahua
subclass could add a method calledtremble()
. So an individual chihuahua instance would use a high-pitchedbark()
from theChihuahua
subclass, which in turn inherited the usualbark()
fromDog
. The chihuahua object would also have thetremble()
method, butLassie
would not, because she is aCollie
, not aChihuahua
. In fact, inheritance is an "a... is a" relationship between classes, while instantiation is an "is a" relationship between an object and a class: aCollie
is aDog
("a... is a"), butLassie
is aCollie
("is a"). Thus, the object namedLassie
has the methods from both classesCollie
andDog
. - Multiple inheritance is inheritance from more than one ancestor class, neither of these ancestors being an ancestor of the other. For example, independent classes could define
Dog
s andCat
s, and aChimera
object could be created from these two which inherits all the (multiple) behavior of cats and dogs. This is not always supported, as it can be hard both to implement and to use well. - Abstraction
- Abstraction is simplifying complex reality by modeling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.
- For example,
Lassie
theDog
may be treated as aDog
much of the time, aCollie
when necessary to accessCollie
-specific attributes or behaviors, and as anAnimal
(perhaps the parent class ofDog
) when counting Timmy's pets.
Abstraction is also achieved through Composition. For example, a classCar
would be made up of an Engine, Gearbox, Steering objects, and many more components. To build theCar
class, one does not need to know how the different components work internally, but only how to interface with them, i.e., send messages to them, receive messages from them, and perhaps make the different objects composing the class interact with each other. - Encapsulation
- Encapsulation conceals the functional details of a class from objects that send messages to it.
- For example, the
Dog
class has abark()
method. The code for thebark()
method defines exactly how a bark happens (e.g., byinhale()
and thenexhale()
, at a particular pitch and volume). Timmy,Lassie
's friend, however, does not need to know exactly how she barks. Encapsulation is achieved by specifying which classes may use the members of an object. The result is that each object exposes to any class a certain interface — those members accessible to that class. The reason for encapsulation is to prevent clients of an interface from depending on those parts of the implementation that are likely to change in the future, thereby allowing those changes to be made more easily, that is, without changes to clients. For example, an interface can ensure that puppies can only be added to an object of the classDog
by code in that class. Members are often specified aspublic, protected or private, determining whether they are available to all classes, sub-classes or only the defining class. Some languages go further: Java uses the defaultaccess modifier to restrict access also to classes in the same package, C# and VB.NET reserve some members to classes in the same assembly using keywords internal (C#) or Friend (VB.NET), and Eiffel and C++ allow one to specify which classes may access any member. - (Subtype) polymorphism
- Polymorphism allows the programmer to treat derived class members just like their parent class' members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to method calls of methods of the same name, each one according to an appropriate type-specific behavior. One method, or an operator such as +, -, or *, can be abstractly applied in many different situations. If a
Dog
is commanded tospeak()
, this may elicit abark()
. However, if aPig
is commanded tospeak()
, this may elicit anoink()
. They both inheritspeak()
fromAnimal
, but their derived class methods override the methods of the parent class; this is Overriding Polymorphism. Overloading Polymorphism is the use of one method signature, or one operator such as "+", to perform several different functions depending on the implementation. The "+" operator, for example, may be used to perform integer addition, float addition, list concatenation, or string concatenation. Any two subclasses ofNumber
, such asInteger
andDouble
, are expected to add together properly in an OOP language. The language must therefore overload the addition operator, "+", to work this way. This helps improve code readability. How this is implemented varies from language to language, but most OOP languages support at least some level of overloading polymorphism. Many OOP languages also support parametric polymorphism, where code is written without mention of any specific type and thus can be used transparently with any number of new types. Pointers are an example of a simple polymorphic routine[dubious ] that can be used with many different types of objects.[3] - Decoupling
- Decoupling allows for the separation of object interactions from classes and inheritance into distinct layers of abstraction. A common use of decoupling is to polymorphically decouple the encapsulation, which is the practice of using reusable code to prevent discrete code modules from interacting with each other. However, in practice decoupling often involves trade-offs with regard to which patterns of change to favor. The science of measuring these trade-offs in respect to actual change in an objective way is still in its infancy.
Not all of the above concepts are to be found in all object-oriented programming languages, and so object-oriented programming that uses classes is called sometimes class-based programming. In particular, prototype-based programming does not typically use classes. As a result, a significantly different yet analogous terminology is used to define the concepts of object and instance.
Main features
The attempt to distill OOP to a minimal set of features is considered futile by programming language researcher Benjamin C. Pierce. Nevertheless, he identifies the following as fundamental features that are found in most object-oriented languages and that, in concert, support the OOP programming style:[4]
- Dynamic dispatch -- when a method is invoked on an object, the object itself determines what code gets executed by looking up the method at run time in a table associated with the object. This feature distinguishes an object from an abstract data type (or module), which has a fixed (static) implementation of the operations for all instances
- Encapsulation (or multi-methods, in which case the state is kept separate)
- Subtype polymorphism
- Class inheritance (or delegation)
- Open recursion -- a special variable (syntactically it may be a keyword), usually called
this
orself
, that allows a method body to invoke another method body of the same object. This variable is late-bound; it allows a method defined in one class to invoke another method that is defined later, in some subclass thereof.
Similarly, in hist 2003 book, Concepts in programming languages, John C. Mitchell identifies four main features: dynamic dispatch, abstraction, subtype polymorphism, and inheritance.[5] Michael Lee Scott in Programming Language Pragmatics considers only encapsulation, inheritance and dynamic dispatch.[6]
See also
- Aspect-oriented programming
- Circle-ellipse problem
- Constructor overloading
- CORBA
- Design by contract
- DCOM
- Dot notation
- GRASP
- IDEF4
- Interface description language
- Lepus3 an Object-Oriented design description language
- Object association
- Object database
- Object-oriented analysis and design
- Object-relational impedance mismatch (and The Third Manifesto)
- Object-relational mapping
- Procedural programming
- Refactoring
- Software componentry
- ZZT-oop
References
- ^ Kay, Alan. "The Early History of Smalltalk". Retrieved 2007-09-13.
- ^ a b Armstrong, The Quarks of Object-Oriented Development. In descending order of popularity, the "quarks" are: Inheritance, Object, Class, Encapsulation, Method, Message Passing, Polymorphism, Abstraction
- ^ B. Stroustrup, The C++ Programming Language, 3rd-ed., p. 158
- ^ Pierce, Benjamin (2002). Types and Programming Languages. MIT Press. ISBN 0-262-16209-1., section 18.1 "What is Object-Oriented Programming?"
- ^ John C. Mitchell, Concepts in programming languages, Cambridge University Press, 2003, ISBN 0521780985, p.278
- ^ Michael Lee Scott, Programming language pragmatics, Edition 2, Morgan Kaufmann, 2006, ISBN 0126339511, p. 470
- ^ a b A Theory of Objects, Martin Abadi and Luca Cardelli
- ^ Meyer, Second Edition, p. 230
- ^ M.Trofimov, OOOP - The Third "O" Solution: Open OOP. First Class, OMG, 1993, Vol. 3, issue 3, p.14.
- ^ "Mode inheritance, cloning, hooks & OOP (Google Groups Discussion)".
- ^ http://www.csm.ornl.gov/~v8q/Homepage/Papers%20Old/spetep-%20printable.pdf
- ^ C. J. Date, Introduction to Database Systems, 6th-ed., Page 650
- ^ C. J. Date, Hugh Darwen, Foundation for Future Database Systems: The Third Manifesto (2nd Edition)
- ^ The AI Effect
- ^ STLport: An Interview with A. Stepanov
Tidak ada komentar:
Posting Komentar