W1401 Object Oriented Design

From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Introduction[edit]

Object Oriented Design is the problem solving approach in programming paradigm where object oriented approach is followed. In simple words object oriented designing is the way of breaking down distinct aspects of a problem into modules called objects and developing a solution by making those objects interact with each other by sending messages or information. This approach is adopted by many programming languages, not only Swift, but also in Java, Java Script, C#, C++, Python, Ruby etc. and dates back to 1950s. While being so, object oriented designing of programming and algorithms have been considered as one of the most efficient ways of problem solving in programming domain while other major paradigm is structured programming approach. While structures programming is considered task-centric, object oriented design is known to be data-centric.

In Object oriented designs, the objects are used to model different components of the problem which ranges from the physical things like a book, a touch on a screen, a database to more complex representations of abstraction like the daily petrol price, fluctuation of rate of interest etc.

Definition of Object[edit]

Object is the encapsulated representation of an entity which combines the data and the associated procedure. The rules and binding ways are formulated in object interface following which the interaction of the objects takes place. Before grasping the advanced and real life usage of objects, for basic familiarity and easy understanding, its better to start with the physical things like taking it literally.

Going DeeperGoingDeeperIcon.png
  • The usage of the word 'object' has its genesis in programming paradigm within the group of Scientists working for Artificial Intelligence basing on LISP programming Language at MIT back in late 1950.

Generally, in object oriented designs, the objects are designed to describe a set of general concepts and then extending to more specific types. Start with the concept of Electronic gadgets. After defining electronic gadgets, you can create (in abstraction) the extended concept of electronic gadget like Mobile Phones, Smart Watches, Tablets etc. which are more specific kinds but can be derived from the same object.

Defining Object in Swift[edit]

Properties[edit]

// Example of declaration of class
class Gadget {
  // 2
  let brand: String
  // 3
  init(brand: String) {
    //4 
    self.brand = brand
  }
}


Methods[edit]

There are some key principles of object and its relationship with the class and other objects, which have been detailed as follows:

Encapsulation[edit]

Information hiding[edit]

Inheritance[edit]

Interfaces[edit]

Polymorphism[edit]

Key Concepts[edit]

Exercises[edit]

References[edit]

[1] [2]