1 / 16

Concepts in Object-Oriented Design( 객체 지항 설계의 개념 )

Concepts in Object-Oriented Design( 객체 지항 설계의 개념 ). CSCI 240. Harshit Kumar CS Department, USW E-mail: harshitkumar@suwon.ac.kr. Example: Classroom. Attending the lecture we have several individuals Wade - loves Chinese food George - an outdoorsman( 야회스포츠애호가 )

keely
Download Presentation

Concepts in Object-Oriented Design( 객체 지항 설계의 개념 )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Concepts in Object-Oriented Design(객체 지항 설계의 개념) CSCI 240 Harshit Kumar CS Department, USW E-mail: harshitkumar@suwon.ac.kr

  2. Example: Classroom • Attending the lecture we have several individuals • Wade - loves Chinese food • George - an outdoorsman(야회스포츠애호가) • Wendle - is a sports nut(스포츠광) • Lee - doesn't eat anything with a vowel(모음) in its name • These are the students of our lecture Note(유념하여라) that the individuals are not identical(동일한). Wade George Wendle Lee

  3. Abstraction(추상) and Classes • From our perspective(전망), we see them as an instantiation((학설등의 )예)of a "Class", Student • has a name • attends class • has a grade • completes assignments Note the each student looks the same even though the are different individuals • A Class defines an "Abstraction“(추상) • OO Abstractions are based (기초로 둔다)on • data (name, grade, attendance record) • "Attributes(속성)" • simple access • behavior (행동)(completes(완료하다) assignments, attends class) • "Operations/Methods“(작동/방법) • complex properties(속성) • relationships (student in course) • External(외부) implementations(실행)

  4. Objects(객체), Instances(예) of a Class • Classes define what properties(소유권) will exist in each instance • Objects provide distinct(명료한) instances that exhibit(나타내다) those properties Class Objects George : Student · Name=“George” · Attendence=100% · Current Grade=A Lee : Student · Name=“Lee” · Attendence=85% · Current Notice that the data members are replicated(복사하다)din each object. Each object is an instance of Student. It does not make sense to replicate member functions. Grade=B

  5. Messaging Supports Encapsulation • We interact(상호작용하다) with objects through "messages" • Messages allow object to determine(결정하다) implementation(실행) rather than the sender determining the implementation for each instance. Messages are passed and handled, rather than invoked like functions.

  6. Polymorphism(다형성) Supports Encapsulation • Allows an object of any implementation type, which satisfies the interface(의사소통도구) defined by the abstraction, to be used by a generic(일반적인) reference to an abstraction. • Promotes(촉진시켜라) a separation(분리) of interface and implementation (작업의수행) class GraduateStudent : Student ; float calculate(계산)Score(Student s); GraduateStudent George; calculateScore(George) Wade is an undergraduate (졸업안한)Student George is an graduate (졸업)Student Polymorphism says that you can treat both Wade and George as Students if the distinction between undergraduate and graduate is not important.

  7. Hierarchies(계층화) • Organize(조직하여라) lower level abstractions into more complex abstractions • Hierarchies allow more complex(복잡한) abstractions to be understood • Two basic forms • Inheritance(상속) • Generalization(일반화) – Specialization(특별화) • Base Class(기본클래스) - Derived Class(파생클래스) • Parent – Child(부모-자식) • Abstract Class – Concrete(구체적인) Class • Aggregation(집합) (many-to-one relationships) • Whole - Part • Containership • Collection • Group

  8. Inheritance Hierarchy(상속계층) • an "is-A" relationship(관계) • Inheritance (상속) • for type - a re-use of common interface • for class - a re-use of common interface and implementation(수행작동) Student Person · Name · Name · Attendence · Current Grade

  9. Aggregation(집합) Hierarchy • a "has-A" relationship • Assembly(조립하다)-part - where the aggregation of parts makes up the whole • ex: airplane is an aggregation of wings, wheels, motor, prop, etc. • container-contents - where the container exists with or without contents • ex: classroom is an aggregation of students, instructor, tables, chairs, etc. • group-member - where members are logically associated(관련되다) with whole • ex: course has students and teachers as members • "weak has-A" - where there is more of a peer-to-peer relationship between abstractions(추상적개념) (association) • ex: Instructor(교사) has students, Students have instructor

  10. Comparison of Functional vs. OO Views Register Student Submit Grade Students Grades Students Student/Grades Print Transcript(성적증명표)

  11. Addition of a New Student Type • Changes in data types cause significant impact(영향을주다) to functional approaches(접근하다) • OO approaches allow new object types to re-define functionality(기능) Register Student Submit Grade Students/ Pass Fail Students Grades/PF Impact Areas Students Student/Grades/PF Print Transcript function override (보다우선순위를두다)

  12. Addition of New Report Type • Changes in functionality based on stable(고정된) data causes significant impact across objects • Functional(기능적인) approaches allow new functions to augment (증가시키다) functionality Register Student Submit Grade Impact Areas Students Grades Students Student/Grades/PF Student/Grades/PF Print Report Card Print Transcript

  13. Re-organization(재조직) of OO Abstractions • Data dependent(의존하는) behavior handled(처리하다) by derived classes • New functionality handled by new associated classes ("wrappers", "adapters", "views")

  14. UML Sample Package View

  15. UML Sample Class View Diamond implies composition: All MediaTopics together comprise a CardCatalog. Notice that this sample class view does not include visibility(가시성) indicators.(척도)

  16. Acknowledgements • This presentation is an adaptation(번안) of materials developed by Jim Stafford, John Hopkins University. Used by permission.

More Related