0% found this document useful (0 votes)
13 views50 pages

Oose Notes

This document discusses the principles of object-oriented software design, focusing on modularization, cohesion, and coupling. It outlines the advantages and disadvantages of modular design, as well as key concepts such as classes, inheritance, polymorphism, abstraction, and encapsulation. The document emphasizes the importance of these principles in creating manageable, reusable, and maintainable software systems.

Uploaded by

arjun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
13 views50 pages

Oose Notes

This document discusses the principles of object-oriented software design, focusing on modularization, cohesion, and coupling. It outlines the advantages and disadvantages of modular design, as well as key concepts such as classes, inheritance, polymorphism, abstraction, and encapsulation. The document emphasizes the importance of these principles in creating manageable, reusable, and maintainable software systems.

Uploaded by

arjun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 50
UNIT —3 Module —- Dn abject oriented software oagiaierny re bday isa Adlf cont aind usit of code that contains Selat fanctton ality and data . * A module contain closses, functtons » variables an Other programming construct that are designed to ia ‘together to achieve a Apectfic: task ov bet Of tasks. Modules ave offer implemented as seperate files ov ct ties ina Aofteere project : Mod ita’ be x Dt Apecifies to the division oY Software inte Seperale modules which are differ entty named and addresses and @y aqye ated J inte ‘1 fate, on to obtain t Completely functtonal Soptware * 91 1S the only Property thet allows a program ~> be cuntle Lee tually manageable - . x Single Aasqe Programs ave cifptealt to understand a Sead duc te a favgqe number of Reference veciables » Control paths + quest vatiables, e&C-- Advantages 79+ allows forge propams to be tovitten be ciferent Pe x at provides more checkpdnts to measure Propesd: § a framework fox Complete testing , move x at provide accesstble to test - at produced the well aeSignedt and more, seadsbli am Disadvantages Execution time may be Longer. storage Size Perhaps + but is not Centainlyincre® Compilation Bnd Loading the may be Aonger Qunter—-madule Communcetion problems May be Increase x kk RR yr . Modular Resign gecluces th 4 j et tes Soliman covet and Sesults in easier an ntation by allorsi i yosious posls ofa i stem my Peete a a tt contains func tional “mdependence and caforma tion pid g- w functional ‘independence can be measiuved in using cago cutleat oe - W- Cohesion @— Coupling? w+ Cohesion s— oheslon ~ measures the Belative function strength of a module KE ave afferent classes of cohesion that a mada le x There may possess ~ M= functional Hah ©)— Sequential (O- Cormmunti cational @- progedural © — Tersporal a. hegfeat Q- coincidental Low * Cohesion is defined as The cleqree to which the elemenl of & posticulay module ove function ably selated * Basically i cohesion 1g used to Measure the functional Seenq™ ok module ‘ tthe systems having Kigh Cohesion with have element uch aS ‘ingtractions + qoups o «nstruc tions , the Agr tion of clafa ctc-. Strongly connected 2 each other- x THIS helps in Emprving “the focus on ‘a aiven’ task ave this, high Coheston 7S. preferred . q @—s Sunctfonal Cohesion — fata KIn tht 4 ‘an this Pe of Cohesion ; the elements ‘inside o moclul ork together to achieve one Common goal * 7) : he elements work im coordination ufith the mdm aime eraging focused onthe task asstaned ] * They perform only the activities which are NeCe Say to the asstoned work b— Sequential Cohesion 2— * Maintdming a Sequence of activities makes our tas, much easiey which i$ Sequential cohesion ¥ Snthis ;the output % a particular activity ack a an wnput to another * THIS helpsin easy maintenance and Provide s qrrd | coupling alue to Q well-cleftned Sequence | ©)—* Communicatfonal Cohesion t— Multiple elements in a module opevale onthe Same finput data and produce the Same output dala O— Proceduvol Cohesion t— The activities din & madule ave elated 54 Sequence other wise thes ave mot Aclated O—> Temporal Cohesion +— * when a module contains functions that ave Se lated by the fact That all the functions must be executed Un the same time Apan, the module 1S Said to exhibit tempoval cohesion f * The Set of functions Sesponsible fox initialization, Start-up, a Shutdown of Some proce ss, etc. exhteit ‘temporal cohesion A= Coincidentol Coheston *- the activities with meaningless elation Ships wstth one avother ave contr? buted by the elemenTS in the module - gQ— dogicol Cohesion s- BE 15 a Fape Of Cohesfor im wohtch all the Clements within a module perform Stmllar eperation Such as ene handling @ — gt measures the Relative a! mod ules ¢ coupling 4S the infer -dependenty or ae _ghip between mult tple mmoctules/ packages] com i « Coupling “15 also called Qntermodulé Bindin Ponen Is x multiple modules are ra infevdependence among e 4 Se lation rly Coupled and ave Shongl: clependent on each other and Some ave Laesely couple, tit aye not clependent on each other: ¥ Good Software 7S always foately coupled &0 11 1S Const _deed aS best practice to make your moduleS Loorel couple ch ivilerclependent » So they can be tested an managed to melintain easthy Types of Coupling” @ d— Data Coupling dh— Stamp coupling iy— Control Coupling i Common Coupliney M — Content Coupling, - dh Lola Coupling 2— When modules shave primitive data between them oh — Stamp Coupling -— when modules Share Composite o: Structuyel clafa between ther. They must be a non bal tafe Soucture . Fev example , pasting an object ov a Structure variable in Seact Components: Oo Two modules ave Stamp coupled tf they commerical esting a composite clata ‘item Such as a secorel an PASCAL ov a Shuchwe™m C. ; at} —> Control Co Ling ¢ then dala from one module 43 used to divect the Stauctuve of instruction execution, in another - ™— Common Coupling :— yjhen two modules Snare ty, Same global clata 4 olependent on them + Suck as State management in TavaSexipt frameworks * M— Content Coupling t— when 200 mectules Shave cod, and can mocthy the cata of another mnocecle » whicg £5 & Poor way of coupling and Should be Avolded Modulavization *K PLING A PwMcess of breaking a Soptvoare ints mmultiph small modules 1 where each module works “inde pendtent *The mmdin advantage of emodulovization 15 that i makes it easy to understand, the Software, makes Ht Acusable 14 %t can be tested easily Object ovienléc Paradigm #45 0 methadolegy ov paradigm tv clesign a pray using Classes and bets d i * * It Arooplifies Sop-toare deve lopment and maintenance by providing Some concepts che main aim of obsect- onented progsamnting “ist dmplement eal esorlel “entithes as follodds 7 C1) — Object @— class @— Dnherrtance & - Pole morphism B- Abstraction @)- encapsulation ty —+ object s- x tng entity thot has state and behavior 45 Known ad object : a 9t can be we MEAS an “instance of o Class: dams an address and takes uP phy sical 2d Logical * t Bn DOP van Ompers 18 Gn 1S an IMNStance of a class that encapsulates deafa ¢ behavior z otjects are the building. blocks % object oviented Parectign coop) a objee Aue 4 one of the Key principles of cop tS encapsulation, which means that dofa 4 behavior of an object are hidden fro other objects € Can only be accessed Chrougt the, objeclS rnethods fs Sepre sents entities ov concepts inthe teal world as Person, A CA¥ or a bank account x ThIS helps eusure that The data is pwtecfed and the behavior of the object %S consistent 4 precti table. & Pn oop, objects can also Aanleract with each other Through mMeS5AGES * . y X overall » objecls in oop ‘paovicle a powerful ¢ plextble wag to Organize 4 model complex tystems- * object ave widely used in sof twsave velopment for butlding appli cations Sanging from Simple scripts to Leg ~ Scale systems Class *— collection of objeck 1S cabled ela ss AFIS & Logical entity. 2n oop, a'class +5 “a blueprint ov & template for crea’ -ing pbtects that Share Similar characteristics 4 behavin Pt dyineS the qttibules (dala members) and methods Cmember func tions) that are Common + all obje fs of the class: class dest consume any Space Lov example, 1s aclass — is K Pt iS having attributes Like eel gear Calor matleoge etc... — Stavt Methods pike ctop ccelerate Brate etc.. These ottiibutec o ccctinde can be used to Creale mubtich einstances oy objects of a Class ecax?, each with TS oe, unique Aet of values for the attributes - =Dn 00P, classes facilitate the encapsulation of tata g behavior into a Aingle unit , allowing for raoctielar, Aeceses Cocke - * Ovevoll, closses are a fundamental Concept iN COP any ave Used exGremely ov exlensively to mode! complex $yee, 4 applications: class Car properties object @— DMnbevitance t— # AEIS one of The fundamendal Concepts in vop * Pt 1S a mechanism by which one class cas ‘mherit the properties ¢ behavivy of another class Known as base class oy super class: * the class that Snheril? wm the base class iS inn as the deviied class & tub class « Pyhesitance allowas for code geusabdli: x Mnhervitance “LS nothing but making a née thi bn, extsting one on having Some extra unctionalitids, «Inheritance Can also Lead to thgat coupling between closes » make them difficult to mnoclify q@ maintain. x Gt enables a eubclass to unhesit the Properties $ behavior of itt super class - which promoles code ves t helps to deduce Redundancy. < 9t enables the creation of move. flexible ¢ moctular code: + EIS used to create clominant objects. Ot Seduces pace ¢ time Ccompleatiy - 3 By using Imneritance ; we Can tecuce the amount " went Of Co, we need £0 write , because we don't have to ipo shared atl butes q methods In each child class : a gee LC 1 cage) Base super Class Propet a property 2 Method 2° Method & pr pel 3 2 Mctho: + Here the superclass has two pwperties Cemperty 2. ¢ Property £) and two, methods (method ¢ Method 2) - => The subclass inherits these properties and methods fron the Auper class bat also adds ittoan property Cprperty 3) and ovesrides one of the tmheriled methods Cptethoel 2) - a— Poly race phism — & Single method can ha have supplied povamelers If one task 16 performed in! diferent wags 1615 knoon as poly morphisn - x Pt IS one of the fundamental concepts in oopthat allow: object of alffoent classes to be used Unter chang ently. x Pt means the ability of an abject to take many forms or ve different behaviors what Wwe Shapes: * poly morphism allows objecls t@ be treated as instances of thely own class ox Instances of a supeaclass % Polymorphism 46 a peoeful feature of oop that pramoles Code eusability 1 flexibility q exten sibility # Ot allows ctevelopers tv write cacle that can handle a vaviel oy object types ¢ behaviors 1 making ctheiy applications more ‘ A a Fo Aobust 4 adaptable to c anger a Aer Re 2 Speak) ft + DY __se - = Press Fl be I at | Deg Tie le &9:.6)—> Abstraction :— v a # The Principle of hicling % data is called abStracti, * DENS a Key concept tn cop that alloios Programmes 1 aepresent features ¢ hicking unnece S$ary. details. * One of the main bengits Of Abstraction i§ that ith to simplify complex syetems by breakin 4 them down int Smaller; more mane le pleces * ey fecessing on the essential features ite implementa tion oetails , modular, Henible ¢ gersable cocke # Thas ,intum, con make it easter to matntain ¢ exten Complex dgstems Over time. of an object the ammers car create mn ?—> Encapsulation :— rapping 4 data and fenctons in a single fogicat | Lait 5S called encapsulation The Purpose of encapsulation 48 to hide the. infernal work of an object from the: outside world and tw protect 1t5 datt from unauthorized access or modification THIS 1S achieveel by olecle ving the clafa members apd elute as private rwhich means thee can onfy be accessed o fs a h “ , naocified theeugh public methods of the Class a Bt provides Aeveral benefil® includ 9 Secutthy ,abshactiin pocdularity ¢ code maintainabilily a qhis irnpuoves code organization v deduces the complexify oF the Code Dynamic Binding ae x #255 olso Known as ale binding ov Runtime polymor —phism « SEIS Q Key features that enables mophic behavior, where a singe method can be'uced with objects of differ classes that Share a common ny inlerface ox mheritance fevare. x waith mic oe the covect implement ation af the method Can be delérmined at auntime based on th actual object being used, alo hing bor great pesitslity ¢ extensi bilitg fn ctecign af The sytwave- a Dynamic binding 18 2 powerful mechanism tn obyiet a fox example, a class that, represent? @ car can be re dn lifferent pasts Of © Pwgarn that need to manipulah, aidplay Angormation, about Cars CVoria bles) eute- On iqeneval , ‘Reusing obj cle can help to ted ~Ce development time and cost. * AS well aS tmpwle Cade maintainability a scalability. * However cif 4S Imporfant to note that objects Should be designed with Aeuse 7n mind ¢ Should be Carefully tested ¢ documented to ensure the gy won as expecta dn clifferent contexts * Reusing objects can Save time and eYfort since Con!t have +0 unite new code to recreate the Same functionals By * objects. pamole Aeuse by allowing ‘progeammers to creak deusable code nodules tn the fom of clastes — Guise “el uaing. cle sign ¢ implementation * Reuse during design: 4 ‘implementation Agers to the practice of using pre-existin Sop tuaave Componenté ov ¢ is ‘ ae sign pathons: cin new Sof toare projects. s x Reuse can provide Séveval beiegilB Auch as comet | ctevelopm ent time, and Coslt + ‘mpieeng Sop fwoare qu and seltaviltty: and Promoting consis: -ent Projects > \ ency acyott ef 3 There ave several tay s in which Aedes € Can be, applied aouving the fal tera. wivetariee sat 1 pet. Bs _s During de sigu phase , Software archrrects Can Use c-extsting clesign patterns or framenmiks to Creale pr -tevel Software architectuses that Can be adapted hig ° if cnptoent projects => Quin implementation phase, developers Can use pre- existing code Libraries ox modules te Speed up thedev a process and auld Ae-tmplementing Common func Honal «72 factittate Seuse it 1S Important to have a well-orge _nized ¢ dearchable Acpository ef seusable component. ¥ patterns e TRIS Can “inclace cnltrnal Libraries and external oped source projects - ¢ However, TIS tmportant t note that geuse 75 n0t ala _ays the best Avlution tn every Case « Keusing components that are not well-suatted to a part cular project can Lead to additfonal complexity and mainlenance overhead + Therefore ¢ 74'S Important to carefull evaluate the suitability of Seasable Components before acopting them in’ @ new project \ Polentify Reusable gt Components | Libraries | as Fevalualt y éelect seussble] ¥ Xk KE wa . wy, Components POX . oO ale Reusable companenB] ints systenn design enplement Seusable Componen tn code “Test 4 Debug 2 eused Components — Dramatically Aiffeent Types 4 seuse are possible dug design The Seused material can van from gest one oF te arGfect to the archifecture of complete Software product - % The vatlous Aqpes of olesign ese of which Caatiy: avin Santo implementation - On Resign Reuse 1— When designing. a product , a member of the dleslan Team may gealize that a class from an earlier LEstgn Can by Aeased dn the curment project, with ov without minor modi fications This tape Of Acuse 1s particularly common -in an organi That develops Sopiware in one Specific application domain such as boning ov ate traffic. control systems. The organization Can promote this Lupe of tewse by set —ation upa Aepasitery of alesiqn Component Hikelg to be Lense, din the fulire ¢ encouraging dedigners to &cuse Them, Perhaps by a Cath bonus for each Such Aeuse - ¥ THIS type of Aeuse, Dindited throug at mcug be have two advantages — — fist -“tesled clesiqns ave Incorporated Vinto the preduct The overall cledgn therefore Can be produced more auietl gis Aikely to have o higher qualily than when the entive desi T8 produced from Sevalch - — Second ,i{ the design of a class can be reused , then it iS Likely that the implementation of that class aliow be dewsed, if not the actual code then atleast cance ae THIS appwach can be extended to tibvaw aeuse - aA Libsary ig a Aet of seloted rterrsable Aoutines: j x for example, clevelopers of Scientific Software rare! vol the methods te Perform Auch common tasks as matt nversion findting igen values. scientific class dibvary Auch as Lapack?? © Onstead, a se T2000) 16 purchased» then whenever possible, the cl cin The Acientfie Alovavy ove utilized win futuse softurare ‘gs Anothes cyample 75 a Pibvan Us Li a Fea eface d for Graphical er x Gnstead of writing The GUE methads from scratch, It is ay more Convenient Fo use a Gua Class Libiany OF joilktt » that ix a set f clases that can ee eyeie aspect y the Gur. i x Many Gu? poolkils of THIS Kind are available ,ncluding the Java Abstract, Windowing Tool Kit ‘ > A pmblem with Library Acuse 16 that LMbvavies preque thy ae presented in the format of a set of seusable code artifact than Aeugable designs Tool kif ; qe" vally promote code. asusotnean clesign Meuse (2- Application “frame Look S ent Uncorporales the control fogic % a olesign x when @ framework 16 Reused the developers hi design tne application - Spectfic operations o the product being built « The places where the applicartion— specie operations art dnseated frequently are Sefewed 10 48 hat spol oe The term framework rodadays usually AeferS to an object oriented application frome wn k 4A frame work 15 Ayined as at Set Of cooperating classes that make up a reusable cle ston for a Specific class Oy Soptivare?- — >The Raytheon CoBod progam Logic Structure of the 19708 isa classical precusor df odag's object ~ orienfee application framengovk % An example of aw application framewonk 75 a set Y classes for the ctedlgn of & Compiler * The clesign team’ merely has provide classes Specfic tothe Language ¢ deswed target machine An example of a pramework 16 o set of Classes for th Software contiojitng an ATM- ave tO

You might also like