450 likes | 823 Views
객체지향 데이타베이스. 이상원 서울대 객체지향 연구실 ( http://oopsla.snu.ac.kr/~swlee). 차례. 객체지향 개념 소개및 데이타베이스 역사 객체지향 데이타베이스: 개념 및 기술. Why OO?. 객체지향( Object Orientation, OO) 패러다임및 객체지형 툴들의 장점 실세계의 자연스러운 모델링 응용도메인의 개체와 객체사이의 1대1 대응 재사용성과 확장성 통합 프레임 워크: 소프트웨어 개발 라이프 사이클 전체에 걸쳐 같은 개념 지원
E N D
객체지향 데이타베이스 이상원 서울대 객체지향 연구실 (http://oopsla.snu.ac.kr/~swlee)
차례 객체지향 개념 소개및 데이타베이스 역사 객체지향 데이타베이스: 개념 및 기술
Why OO? • 객체지향(Object Orientation, OO) 패러다임및 객체지형 툴들의 장점 • 실세계의 자연스러운 모델링 • 응용도메인의 개체와 객체사이의 1대1 대응 • 재사용성과 확장성 • 통합 프레임 워크: • 소프트웨어 개발 라이프 사이클 전체에 걸쳐 같은 개념 지원 • c.f. Vaulting Process • Interaction vs. Algorithm
Why OO?(2) Real-world Problem Object-oriented Concepts ADT OO Analysis OO Design Inheritance Identity Object-Oriented Programming
소프트웨어 개발 비용 절감 Effort: Labor-Months Effort: Labor-Months Size or Functionality Size or Functionality
PL DB UI 사용자 측면의 장점 • 일반 사용자: 사용자 인터페이스, Plug-and-play • 응용프로그램 개발자: 손쉬운 개발툴 • Independent software vendors: enhanced engineering and configuration management tools Object Orientation user requirements
객체지향 패러다임 • OOPL: Java,C++, SmallTalk • OO/ORDB • GUI • OOA/D
프로그래밍 언어의 발전 연사 • 어셈블리어 • 기계어를 기호로 표현(symbolic representation) • Fortran, PL/1, Cobol, Algol60,... • high-level languages: 변수(variables), 배열(arrays), 제어문(control structures), … • Fortran에서 변수이름 충돌 -> Algol의 block 구조(encapsulation)
프로그래밍 언어의 발전 연사(2) • Simula-67 • 객체지향 언어의 효시 • simulation용 언어 • 객체, 메소드, 클래스, 상속 개념 포함 • the foundation of OO language • “strongly typed”
프로그래밍 언어의 발전 연사(3) • LISP • 인공지능용 언어 (cf. CLOS) • 1970년대: 데이타추상화 개념 • grouping of structure and operations • information hiding • Ada(U.S. DoD):
프로그래밍 언어의 발전 연사(4) • Smalltalk • One of the most influential OO language • 객체지향 언어 + 프로그래밍 환경 + GUI • 메뉴기반 대화형 사용자 인터페이스 -> Apple Mac., MS Windows, …. • Built-in 클래스 계층 주조 제공 • “Everything is an object!!” • Not a typed language! • C++ • C + 객체지향 개념
프로그래밍 언어의 발전 연사(5) • 1980년대 • 객체지향 개념이 주목받기 시작 • 1st OOPSLA conference in 1986 and JOOP in 1988 • 1990년대 • 객체지형 개념의 번성
프로그래밍 언어의 발전 연사(6) • Simula: 시초 • Smalltalk : 객체지향 개념의 가능성 • C++: 객체지향 개념의 보급
객체지향 분석및 설계(OOA/D) • 요구명세 (problem definition) • 분석 • OOA(Object-Oriented Analysis) - what • 객체지향 개념및 방법론을 이용한 시스템의 기능을 기술 • 설계 • OOD(Object-Oriented Design) - how • 구현을 위한 청사진
OOA/D(2) Real-world Problem Object-oriented Concepts ADT OO Analysis OO Design Inheritance Identity Object-Oriented Programming
OOA/D(3): 객체지향 개발 과정 1. 특정한 OOA/D 방법론 선택 2. 해당 방법론을 지원하는 CASE 도구 선택 3. 구현을 위한 객체지향 언어 선택 4. Design-before-implementation Prototyping(xx) Expert C++ programmer with many coding discipline(x) Rigorous OOA/D(o) 5. 구현
OOA/D 방법론 • An OOA/D methodology = Notations + Methods • Booch’s Object-Oriented Design • Rumbaugh’s Object Modeling Technique • Shlaer and Mellor’s Analysis and Design • Coad and Yourdon’s OO Analysis and Design ….. • Fusion, etc(as many as world-wide S/E) • UML(Rumbaugh + Booch + Jacobson: Rational) =>OMG adoption!
데이타베이스 발전 역사 • 1950년대: File System • 1960년대: 계층및 네트워크 데이타모델(Bachman, 1972 Turing Award) • 원동력: Random Access Disk 기술 • 1970년대: 관계형 데이타모델(E. F. Codd, 1980 Turing Award) • 원동력: 단순한 모델에 기반한 응용프로그램 개발의 생산성 향상
데이타베이스 발전 역사(2) • 1980년대: 객체지향 데이타모델(???, 199? Turing Award) • 원동력: 복잡한 응용 영역의 모델링 능력및 성능 향상 • 1990년대: 객체/관계형 데이타모델 • 원동력: 관계형 DBMS의 시장 장악력, 안전성 • Active, Deductive,Temporal, Spatial DBs (http://www.cs.umd.edu/~brabec/quadtree/index.html), Data Warehouse(Materialized Views), Data Mining or Knowledge Discovery in Database(KDD), Legacy Data Access, Java + CORBA + DB, Web Site Management System • 2000년대: ??
데이터 모델및 데이타베이스 시스템 • 데이터 모델의 구성 요소 • 구조(Structures): 예) 테이블 • 연산(Operations): 예) Select, Project, Join, Insert etc • 무결성(Constraints): 예) 엔티티 무결성, 참조 무결성 • 데이타베이스 언어: DDL, DML, DCL • xx DBMS = xx 모델을 지원하는 데이타베이스 시스템 • ER 데이터 모델: 개념적 데이타베이스 스키마 설계에 사용되고, 이 모델을 지원하는 시스템은 없다.
계층 및 네트워크 데이터 모델 • CODASYL :COBOL • DBTG(DataBase Task Group) • COBOL + DB • DDL, DML -> foundation for network DBMS • IDS, IDMS, IMS 등
관계형 데이터 모델 • SQL(Structured Query Language)! • Declarative(vs. Procedural) • Specify what is to be accessed from DBs • Data Independence! • Logical vs. Physical • Simple and elegant
관계형 데이타모델(2) • 초기 관계형 데이타베이스 시스템들 • System/R(IBM), INGRES(U.C. Berkeley) • SQL 표준 • SQL1, SQL-89, SQL2, SQL3, SQL4(?) • 표준의 장점 • 주요 RDBMS 회사들 • IBM, DEC, Informix, Oracle, Sybase, Tandem, Borland, MS, Gupta, etc.
세만틱 데이타모델 • 목적: 현실 세계를 정확히 모델링할 수 있는 데이터 모델 • ER 데이터 모델 • Peter Chen • 관계형 DB 설계도구: ERWin(Logic Works사) • c.f 객체지향 DB 설계를 위한 UML: OR-Compass(”) • SDM, Funtional Data Model, IFO 등등
데이타베이스 + 객체지향 • OO Languages + DB capabilities( • ODMG93(ODMG) • 순수 객체지향 DBMS: O2(Ardent), Objectivity, ObjectStore, GemStone, Itasca, POET(XML), SOP • RDB + OO -> ORDB • SQL3(ISO-ANSI standard, X3H2) • 객체/관계형 DBMS: DB2, Informix Universal Server, UniSQL, Oracle8(?), SORP(?) • OO Mapping Over RDB(Persistency, Sybase, IBM SMRC) • 과도기적 아키텍쳐?
객체/관계형 DBMS 현황 • DB2 • IBM’s first type extensible RDBMS • System/R -> SQL/DS, DB2 -> Starburst -> DB2 Universal • User-Defined Types/Functions • BLOBs, Triggers, Integrity Constraints • Database Extenders
객체/관계형 DBMS 현황 • Informix Universal Server • Ingres -> PostGres -> Illustra -> Informix • DataBlades • UniSQL • Won Kim(CyberDB Inc.) • UniSQL/X, UniSQL/M • Oracle8 • ORDBMS from Oracle • Data Catridge
객체및 클래스 • 객체 = 상태 + 연산 • 클래스 = 객체들의 타입정의
객체및 클래스(2): 예 • C++ = C + 데이타추상화 + 상속 • Shape 클래스 class shape { int x; int y; public: shape(int X, int Y); ~shape(); void move(int X, int Y); double distance(shape& S); void draw(); : }
객체및 클래스(3): 예 shape s1(0,0); shape s2(4,5)’ double length; s1.move(1,1); length = s1.distance(s2);
객체및 클래스(4):데이터 추상화 • 정의: 특정한 타입에 대한 연산들을 정의하고 해당 타입의 객체들에 대한 접근을 그 연산을 통해서만 접근하게 함. • 데이타타입 + 연산 + 은닉 • 목적: 클래스 개념을 통해 사용자가 마치 built-in 데이터 타입과 같이 동작하는 자신의 타입을 정의 • abstract data type, user-defined type
객체및 클래스(5):데이터 추상화의 문제점 class shape { int x, y; int type; // 0; circle, 1; square public: void draw() { switch(type) { case 0: ... case 1: ... } } } • 삼각형 타입이 추가되면? 해결책은?
상속(Inheritance) • 데이터 추상화의 inflexibility를 해결 class shape { // 상위클래스(superclass or base class) int x,y; public: : } class circle: public shape { // 하위클래스(subclass or derived class) int radius; public: : }
상속(2): • circle object ‘IS-A’ shape object • 하위클래스는 상위클래스의 모든 상태와 연산자를 상속 shape s1; circle c1; shape* ptr2shape; ptr2shape = &s1; ptr2shape->draw(); ptr2shape = &c1; ptr2shape->draw();
O 상속(3) • O := C new • O is a member of C • O is a member of every superclass of C • O is a member of C1, C2, and C4 • 장점 • 연산 상속 -> 코드 공유 • 상태 상속 -> 자료 공유 C1 C3 C2 C5 C4 O := C4 new
상속(4): 이슈들 • late binding, 연산자 중복(operator overloading) • 단일(single) vs. 다중(multiple) 상속 • 이름 충돌(name conflicts)
상속(5): late binding • 상속개념을 통한 flexibility 지원을 위해 반드시 지원되어야 하는 메커니즘 • 정의: 특정한 연산에 대해 실행될 코드가, 객체의 타입에 따라, (컴파일시가 아닌) 프로그램 실행시에 동적으로 결정 • dynamic binding, operator overloading, polymorphism etc
상속(6): late binding 예 • c++의 가상함수(virtual function) class shape { : virtual void draw(); } class circle: public shape { : void draw(); } s1 shape::draw() shape* ptr2shape c1 circle::draw()
상속(7): 단일 vs. 다중상속 • 단일 상속 • 개념적으로 단순 • 불필요한 정보의 중복 • 다중상속 • 의미적으로 자연스럽고 강력한 모델링 • 이름충돌
상속(8): 이름 충돌 class A { int x; }; class B: public A { int x; } B b; b.x; // A::x, B::x ?
기타 객체지향 개념 • 객체식별자(Object Identifier,OID) • 추상 클래스(abstract class) • 템플릿 클래스(template class) • 은닉(encapsulation)
객체식별자 • 각 객체는 자신의 유일한 식별자를 갖는다. • 객체식별자를 통해서 특정 객체를 참조할 수 있다. • 예: pointer, Record Identifier, Logical OID
추상 클래스 • 정의: 객체를 생성할 수 없는 클래스 • 목적: 하위클래스들에 필요한 인터페이스만 정의 class ABSTRACT { virtual void op1() = 0; } ABSTRACT obj1; // error
템플릿 클래스 • 정의: 타입을 인자로 받아서 정의되는 클래스 • Parameterized Class or Generic Class • 목적: 비슷한 유형의 클래스를 효과적으로 정의 template<class T> class vector { int sz; T* v; public: vector(int size); } vector<int> v1; vector<real> v2;
은닉 class A { private: int X; protected: int Y; public: int Z; }; class B: public/protected/private A { : }