Question

In: Computer Science

Instructions To make the most of programming, you need to deeply understand the principles that underly...

Instructions

To make the most of programming, you need to deeply understand the principles that underly the paradigm that you are using.

For this task you must explain the principles of object oriented programming and relate these to the programs you have created.

Note: Explain is more than just a description, you want to convey a deeper understand- ing that can be achieved with a simple description. Try to relate the principles together and express the depth of your understanding.

Tip: A deep explanation does not need to be a long one. Aim to convey your under- standing in a concise fashion.

Create an article / blog post / letter to a friend / comic / movie / podcast / etc that explains the principles of object oriented programming, as you understand them, and outline what qualities you should look for in good object oriented programs.

  1. Keep it to about 1 or 2 pages of text (if text based)

  2. Videos or podcasts should be kept as short — but still demonstrate depth of understand- ing.

  3. Creativity will be valued

    Tip: Including references to textbooks (not wikipedia) or research papers can help you strengthen your explanation. Remember to reference other peoples work.

Make sure your explanation covers the following:

Concepts and Principles Programming Artefacts

Abstraction

Encapsulation

Class

Method

Inheritance

Polymorphism

Object

Fields

Roles

Responsibilities

Interface

Collaborations

Coupling

Cohesion

Relate these to programs you have written in this unit.

Solutions

Expert Solution

1. Abstraction : In simple words, abstraction means to hide the internal details and to show the features of the program. Let's take an example of a car, the driver will be able to handle the steering wheel, break, clutch, accelarator pedal, but he won't be able to see how the engine works, how the horn blows and how the interior mechanism works, because its waste of knowing for a driver, his job is to just drive the car from one point to another. Similar is the case with the users who wants to utilize the softwares and applications, they will only deal with exterior features and interface and doesnt worry about the internal functionality and work flow. It is one of the key concepts of OOP language. It was made to handle the complexity by hiding hiding unnecessary details from the user. That enables the user to implement more complex logic on top of the provided abstraction without understanding or even thinking about all the hidden complexity.

Encapsulation: was also made to hide the complexity of code.

Encapsulation is one of the fundamental concepts in object-oriented programming (OOP). It describes the idea of bundling data and methods that work on that data within one unit, e.g., a class in Java.

This concept is also often used to hide the internal representation, or state, of an object from the outside. This is called information hiding. The general idea of this mechanism is simple. If you have an attribute that is not visible from the outside of an object, and bundle it with methods that provide read or write access to it, then you can hide specific information and control access to the internal state of the object.

If you’re familiar with any object-oriented programming language, you probably know that these methods as getter and setter methods. As the names indicate, a getter method retrieves an attribute, and a setter method changes it. Depending on the methods that you implement, you can decide if an attribute can be read and changed, or if it’s read-only, or if it is not visible at all. As I will show you later, you can also use the setter method to implement additional validation rules to ensure that your object always has a valid state.

Inheritance: iThe irole ithat iinheritance iplays iin ithis ioptimization iis iin iallowing isoftware iengineers ito icreate iclass ihierarchies, iwhere iclasses iand iobjects iinherit iproperties iand ibehaviors ifrom itheir iparent i(or isuper) iclass. iA iclass ithat iinherits ifrom ia iparent i(or isuper) iclass iis icalled ia isubclass ior ichild iclass, iand iobjects ithat ireceive iproperties iand ibehaviors ifrom ia iparent ithrough iinheritance iare ireferred ito ias ichild iobjects.

Creating ia iunique iclass ifor ievery isingle ianimal iwould iquickly iget ivery irepetitious ibecause ithere iare isome iproperties iand ibehaviors ithat iapply ito ievery isingle ianimal, ifrom ia imouse ito ian ielephant. iShared ifunctions imight iinclude ifeed( i), ihydrate( i), icleanEnclosure( i). iInstead iof icreating ithese ishared iattributes iover iand iover ifor ievery ianimal, iwe icould iinstead icreate ia iparent iAnimal iclass! iThis iparent iclass iwould icontain ithe iproperties iand ibehaviors iuniversal ito iall ianimals iand isave ius ifrom ihaving ito icreate ithose ishared ifunctions iad iinfinitum.

In ithis iway, ian ielephant, ia imouse, iand ia ichimpanzee iwould iall ihave itheir iown ichild iclass iwhich iwould iinherit ifrom ithe iAnimal iparent iclass. iFurthermore, iNoah icould icontinue ito ibuild ion ithose iinherited iattributes ito ifurther icustomize ithese iclasses ias inecessary. iLastly, iinheritance iallows ius ito ilimit ithe ichances iof ihuman ierror ithat imight iarise iif imanually iinputting ithese ishared ifunctions.

There iare idifferent itypes iof iinheritance

1. Single iInheritance: iHere, ia inew iclass iis iderived ifrom ian iexisting iclass.

2. Multiple iinheritance: iHere, ia inew iclass iis iderived ifrom imultiple ibase iclasses

3. Multi ilevel iinheritance: iHere, ione iclass ican iinherit ifrom ia iderived iclass. iHence, ithe iderived iclass ibecomes ithe ibase iclass ifor ithe inewly icreated iclass

4. Hierarchical iinheritance: iHere, imultiple inew iclasses ican ibe icreated ifrom ia isingle iparent iclass/ ibase iclass

5. Hybrid iinheritance: iIt iis ia icombination ior i2 ior imore ithan i2 iinheritance

Polymorphism: iPolymorphism iis ithe icapability iof ia imethod ito ido idifferent ithings ibased ion ithe iobject ithat iit iis iacting iupon. iIn iother iwords, ipolymorphism iallows iyou idefine ione iinterface iand ihave imultiple iimplementations.

Real ilife iexample iof ipolymorphism: iA iperson iat ithe isame itime ican ihave idifferent icharacteristic. iLike ia iman iat ithe isame itime iis ia ifather, ia ihusband, ian iemployee. iSo ithe isame iperson iposses idifferent ibehaviour iin idifferent isituations. iThis iis icalled ipolymorphism.

Polymorphism iis iconsidered ias ione iof ithe iimportant ifeatures iof iObject iOriented iProgramming. iPolymorphism iallows ius ito iperform ia isingle iaction iin idifferent iways. iIn iother iwords, ipolymorphism iallows iyou ito idefine ione iinterface iand ihave imultiple iimplementations. iThe iword i“poly” imeans imany iand i“morphs” imeans iforms, iSo iit imeans imany iforms.

In iJava ipolymorphism iis imainly idivided iinto itwo itypes:

· Compile itime iPolymorphism

· Runtime iPolymorphism

Compile itime ipolymorphism: iIt iis ialso iknown ias istatic ipolymorphism. iThis itype iof ipolymorphism iis iachieved iby ifunction ioverloading ior ioperator ioverloading.

Runtime ipolymorphism: iIt iis ialso iknown ias iDynamic iMethod iDispatch. iIt iis ia iprocess iin iwhich ia ifunction icall ito ithe ioverridden imethod iis iresolved iat iRuntime. iThis itype iof ipolymorphism iis iachieved iby iMethod iOverriding

Roles iand iresponsibilities iof iinterface:

The ipurpose iof iinterfaces iis ito iallow ithe icomputer ito ienforce ithese iproperties iand ito iknow ithat ian iobject iof iTYPE iT i(whatever ithe iinterface iis i) imust ihave ifunctions icalled iX,Y,Z, ietc.

An iinterface iis ia iprogramming istructure/syntax ithat iallows ithe icomputer ito ienforce icertain iproperties ion ian iobject i(class). iFor iexample, isay iwe ihave ia icar iclass iand ia iscooter iclass iand ia itruck iclass. iEach iof ithese ithree iclasses ishould ihave ia istart_engine() iaction. iHow ithe i"engine iis istarted" ifor ieach ivehicle iis ileft ito ieach iparticular iclass, ibut ithe ifact ithat ithey imust ihave ia istart_engine iaction iis ithe idomain iof ithe iinterface.

Cohension: iCohesion iis ithe iObject iOriented iprinciple imost iclosely iassociated iwith imaking isure ithat ia iclass iis idesigned iwith ia isingle, iwell-focused ipurpose.
The
imore ifocused ia iclass iis, ithe icohesiveness iof ithat iclass iis imore. iThe iadvantages iof ihigh icohesion iis ithat isuch iclasses iare imuch ieasier ito imaintain i(and iless ifrequently ichanged) ithan iclasses iwith ilow icohesion. iAnother ibenefit iof ihigh icohesion iis ithat iclasses iwith ia iwell-focused ipurpose itend ito ibe imore ireusable ithan iother iclasses.

Example i: iSuppose iwe ihave ia iclass ithat imultiply itwo inumbers, ibut ithe isame iclass icreates ia ipop iup iwindow idisplaying ithe iresult. iThis iis ithe iexample iof ilow icohesive iclass ibecause ithe iwindow iand ithe imultiplication ioperation idon’t ihave imuch iin icommon.

Note: IF you can probide mw with code, then can relate these concepts with your assignment code.

Hope I answered the question.

If you have any doubts, or queries, feel free to ask

I'll respond to you as soon as I can.

Have a nice day


Related Solutions

i need a full explanation in details Object Oriented Programming Principles Principles Polymorphism Inheritence Encapsulation Abstraction...
i need a full explanation in details Object Oriented Programming Principles Principles Polymorphism Inheritence Encapsulation Abstraction Class Object Method Message Passing
In a short essay make clear what you understand to have been the most important constitutional...
In a short essay make clear what you understand to have been the most important constitutional problems that have faced Ukraine since independence.
Code in C Instructions For this programming assignment you are going to implement a simulation of...
Code in C Instructions For this programming assignment you are going to implement a simulation of Dijkstra’s solution to the Dining Philosophers problem using threads, locks, and condition variables. Dijkstra’s Solution Edsgar Dijkstra’s original solution to the Dining Philosophers problem used semaphores, but it can be adapted to use similar mechanisms: • Each philosopher is in one of three states: THINKING, HUNGRY, or EATING. • Every philosopher starts out in the THINKING state. • When a philosopher is ready to...
How do you make a soldenoid(coil) with 3D printer. I need detailed instructions so i can...
How do you make a soldenoid(coil) with 3D printer. I need detailed instructions so i can make it my self?
NEED IN C++ For the following programming problems, you need to time a section of code...
NEED IN C++ For the following programming problems, you need to time a section of code in C++. For example, the following statements time the execution of the function doSomething: #include clock_t start = clock(); doSomething(); clock_t finish = clock(); double overallTime = static_cast(finish - start)/ CLOCKS_PER_SEC; Consider the following two loops: //Loop A for(i = 1; i <= n; i++)    for(j = 1; j <= 10000; j++)     sum = sum + j; //Loop B for(i = 1;...
We need to talk about APPLE Company. We need to talk about and analyze DEEPLY using...
We need to talk about APPLE Company. We need to talk about and analyze DEEPLY using appropriate graphs and figures to clarify your ideas. We need to talk about Apple using deep financial analysis to check the price fluctuation regarding the stock exchange market and stock market index. We need to analyze the function of the stock exchange market, and also we need to analyze the effect of the financial market on Apple company and on investors.
Assignment 1 – Writing a Linux Utility Program Instructions For this programming assignment you are going...
Assignment 1 – Writing a Linux Utility Program Instructions For this programming assignment you are going to implement a simple C version of the UNIX cat program called lolcat. The cat program allows you to display the contents of one or more text files. The lolcat program will only display one file. The correct usage of your program should be to execute it on the command line with a single command line argument consisting of the name you want to...
I need a short and clear opinion so I can understand the question and make my...
I need a short and clear opinion so I can understand the question and make my own opinion Writing in the 19th century, the British economist Thomas Malthus argued that the law of diminishing marginal returns implied eventual misery for humanity because, in the case of agriculture, there is a fixed amount of available land and additional labor would only yield ever smaller increases in food production. The inevitable result, as Malthus saw it, was that population growth would eventually...
I need a step by step explanation to problem 14-26 in order to make me understand...
I need a step by step explanation to problem 14-26 in order to make me understand the solution: 14-26 Direct Materials and Direct Labor Variance Schmidt Machinery Company used 3,450 pounds of aluminum in June to manufacture 920 units. The company paid $28.50 per pound during the month to purchase aluminum. On June 1, the company had 50 pounds of aluminum on hand. At the end of June, the company had only 30 pounds of aluminum in its warehouse. Schmidt...
Note: I need a code and other requirement Note: programming language is c++ If you need...
Note: I need a code and other requirement Note: programming language is c++ If you need more information, please clarify what information you want. consider solving the equation sin(x) - e^(-x) = 0 write a computer program to solve the given equation using: 1- bisection method 2- fixed-point method 3- newton's intervals: {0,1},{1,2},{2,3},{3,4},{4,5},{5,6},{6,7},{7,8},{8,9},{9,10} choose accuracy E = 10^(-5) Make sure you document your program Requirement : 1- Mathematical justification 2- algorithem description 3- code (program) with documentation 4-output: roots ,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT