SlideShare a Scribd company logo
학기 발표
객체지향개발론
2011136139 홍길석
개요
• 프로젝트 소개
• 적용한 설계 패턴 소개
• 패턴을 통해 얻은 장단점
프로젝트 소개
3D 공포 호러게임
야간 경비원 CCTV를 수시로 확인해야 한다.
프로젝트 소개
박물관
박물관 내부구조
3D 공포 호러게임
프로젝트 소개
3D 공포 호러게임
프로젝트 소개
3D 공포 호러게임
4
프로젝트 소개
3D 공포 호러게임
적용한 설계 패턴 소개
팩토리 메소드 패턴
적용한 설계 패턴 소개
팩토리 메소드 패턴
패턴을 통해 얻은 장단점
장점
• 다른 종류의 귀신을 추가하기 편리함
• 코드 중복성 감소
패턴을 통해 얻은 장단점
단점
• 클래스 수가 많아짐
• 구체적 클래스용 메소드의 빈번한 호출
QnA
Thank you

More Related Content

Viewers also liked

Geophysical survey for the risk management
Geophysical survey for the risk managementGeophysical survey for the risk management
Geophysical survey for the risk management
Mario Naldi
 
Raah International distributors for Frictape Safety Nets
Raah International distributors for Frictape Safety NetsRaah International distributors for Frictape Safety Nets
Raah International distributors for Frictape Safety Nets
Sarah Shaikh
 
Tools makeup worksheet wiht answers
Tools makeup worksheet wiht answersTools makeup worksheet wiht answers
Tools makeup worksheet wiht answers
SEBASTIAN-9022
 
One SAP Sales Methodology Cert
One SAP Sales Methodology CertOne SAP Sales Methodology Cert
One SAP Sales Methodology CertKelvin Tan
 
Escursioni a Courmayeur
Escursioni a CourmayeurEscursioni a Courmayeur
Escursioni a Courmayeur
Idea Montagna Editoria e Alpinismo
 
Tools makeup
Tools makeupTools makeup
Tools makeup
edwinmales5
 
Ferrate nelle Pale di San Martino
Ferrate nelle Pale di San MartinoFerrate nelle Pale di San Martino
Ferrate nelle Pale di San Martino
Idea Montagna Editoria e Alpinismo
 
Developing Retained Organization to Support Outsourcing
Developing Retained Organization to Support OutsourcingDeveloping Retained Organization to Support Outsourcing
Developing Retained Organization to Support Outsourcing
Mark Peacock
 
Secondary storage devices
Secondary storage devicesSecondary storage devices
Secondary storage devices
Abhinav Kp
 

Viewers also liked (9)

Geophysical survey for the risk management
Geophysical survey for the risk managementGeophysical survey for the risk management
Geophysical survey for the risk management
 
Raah International distributors for Frictape Safety Nets
Raah International distributors for Frictape Safety NetsRaah International distributors for Frictape Safety Nets
Raah International distributors for Frictape Safety Nets
 
Tools makeup worksheet wiht answers
Tools makeup worksheet wiht answersTools makeup worksheet wiht answers
Tools makeup worksheet wiht answers
 
One SAP Sales Methodology Cert
One SAP Sales Methodology CertOne SAP Sales Methodology Cert
One SAP Sales Methodology Cert
 
Escursioni a Courmayeur
Escursioni a CourmayeurEscursioni a Courmayeur
Escursioni a Courmayeur
 
Tools makeup
Tools makeupTools makeup
Tools makeup
 
Ferrate nelle Pale di San Martino
Ferrate nelle Pale di San MartinoFerrate nelle Pale di San Martino
Ferrate nelle Pale di San Martino
 
Developing Retained Organization to Support Outsourcing
Developing Retained Organization to Support OutsourcingDeveloping Retained Organization to Support Outsourcing
Developing Retained Organization to Support Outsourcing
 
Secondary storage devices
Secondary storage devicesSecondary storage devices
Secondary storage devices
 

KOREATECH security 추가아이디어

Editor's Notes

  1. 발표를 시작하겠습니다. 저의 발표는 프로젝트 소개, 적용한 설계 패턴 소개, 패턴을 통해 얻은 장단점 순으로 진행하겠습니다.
  2. 제가 소개할 프로젝트는 3D 공포 호러게임입니다. 주인공은 야간경비원으로 취업하였으며, 자정부터 6시까지 귀신의 공격으로부터 살아남으면 승리하게 됩니다. 경비원은 경비실에서 CCTV를 통해 귀신의 위치를 확인할 수 있으며 선택에 따라 각 방에 있는 문과 조명을 조작할 수 있습니다.
  3. 공간적 배경은 박물관이며, 내부구조는 오른쪽 그림과 같이 큐브 형태입니다. 각 방은 10m 정육면체의 형태를 가지며 주인공은 총 27개의 방 중에 중앙에 있는 방에 위치합니다.
  4. 게임은 방식은 무궁화 꽃이 피었습니다 게임과 비슷합니다. 평소에는 CCTV를 통해 귀신들을 봐도 움직이지 않습니다. 하지만 특정한 주기마다 귀신들은 움직입니다. 귀신들은 큐브형태의 맵의 어느 방에서 바로 옆방으로만 이동할 수 있습니다. 따라서 주인공은 문을 조작하여 귀신이 자신의 방으로 들어와 공격하지 못하도록 막아야 합니다.
  5. 귀신은 총 네명이며 큐브의 꼭지점에 있는 8개의 방 중에서 4개의 방이 선택되어 각각의 귀신들이 생성됩니다. 네명의 귀신 중 세명의 귀신은 경비실의 전자장치를 공격하고 나머지 한명의 귀신은 주인공을 죽입니다. 즉 머리귀신은 CCTV를 고장내고, 거미귀신은 문조작장치를 고장내고, 인형귀신은 조명조작장치를 고장냅니다. 그리고 처녀귀신은 주인공을 죽입니다.
  6. 또한 귀신이 생성되는 4개의 방은 각각의 귀신에게 특별한 능력을 부여합니다. 각 방은 방1부터 방4라고 한다면 방1에서 생성된 귀신은 자신의 분신을 생성하여 주인공을 교란시킬 수 있습니다. 방2에서 생성된 귀신은 주인공에게 CCTV를 통해 환술을 걸어 주인공의 경비업무를 방해합니다. 방3에서 생성된 귀신은 주인공에게 전화를 걸어 태블릿 사용을 못하게 방해합니다. 방4에서 생성된 귀신은 경비실 근처에 있을 때 기다리지 않고 달려와서 바로 죽입니다. 예를 들어 방1에서는 머리귀신, 거미귀신, 인형귀신, 처녀귀신 중 한명이 생성될 수 있으며, 다른 방에서는 생성된 귀신을 제외한 나머지 귀신들이 생성됩니다.
  7. 프로젝트에 대한 간단한 소개는 여기까지 하고, 제가 적용한 패턴을 소개하겠습니다. 저는 팩토리 메소드 패턴을 적용하였습니다. 먼저 귀신이라는 추상 클래스를 생성하여 네명의 귀신들이 공통적으로 갖는 속성과 수행을 정의하였습니다. 현재 위치한 방 번호, 움직일때 사운드, 놀래킬때 사운드, 27개의 방에서 경비실로 가는 경로, 처음 시작한 방의 번호를 갖고 있고, move함수를 통해 다음 턴에 이동하도록 하였습니다. 그리고 자식클래스로 머리귀신, 거미귀신, 인형귀신, 처녀귀신을 정의하였습니다. 클래스 관계도 아래를 보면 Room1HeadGhost부터 Room4HeadGhost까지 네개의 concrete product 클래스가 있습니다. 즉 여기서는 HeadGhost 클래스는 produc이고, Room1HeadGhost부터 Room4HeadGhost클래스까지가 concrete product 클래스입니다. 따라서 실제로 생성하는 객체는 Room1HeadGhost 클래스부터 Room4HeadGhost입니다. HeadGhost가 product 클래스이기 때문에 SpiderGhost, DollGhost, SingleWomanGhost도 또한 product 클래스입니다. 따라서 나머지 세개의 클래스도 Room1부터 Room4까지의 concrete product 클래스가 존재하는데 여기서는 생략한 것 뿐입니다.
  8. 다음으로 creator 클래스입니다. Room 클래가 creator 클래스이고, Room1부터 Room4까지의 클래스가 concrete creator 클래스입니다. Room클래스에서 하나의 방마다 공통적으로 가진 속성인 CCTV, 조명 등에 대한 것이 있고 추상함수인 createGhost가 선언되었습니다. 이 createGhost 함수는 concrete creator 클래스에서 구현됩니다. 예를 들어 Room1 클래스에서 createGhost함수를 정의하면 Room1HeadGhost, Room1Spider, Room1DollGhost, Room1SingleWomanGhost 중 하나를 생성하여 반환하게 됩니다.
  9. 토리 메소드 패턴을 사용하여 귀신들을 정의하면 다른 종류의 귀신들을 추가하기가 쉽다. 만약 팩토리 메소드 패턴을 사용하지 않고 귀신을 추가해야 한다면 creator 클래스부분에서 if문으로 타입을 구분하여 각각의 귀신들을 정의하는데 여기서 if문이 더 추가한 후에 정의를 해야 하기 때문에 creator 소스를 수정해야하는 문제가 생긴다. 이렇게 될 경우 소스코드가 많아질 경우 가독성이 떨어지며, 잘못된 참조로 인해 버그나 오류가 발생할 확률도 높아진다. 따라서 팩토리 메소드 패턴을 통해 product와 creator를 구분하여 접근할 경우, 나중에 코드 수정할 경우에도 가독성이 높고, 잘못된 참조를 할 가능성이 낮아지므로 더욱 좋은 방법이라 할 수 있다. 또한 product와 concrete product와 같이 상속의 개념을 사용하기 때문에 코드의 중복성이 적습니다.
  10. HeadGhost는 product이고 Room1HeadGhost, Room2HeadGhost, Room3HeadGhost, Room4HeadGhost가 concrete product이다. 그런데 HeadGhost뿐만 아니라 SpiderGhost, DollGhost, SingleWomanGhost와 같이 product가 하나 더 생길때마다 concrete product가 4개씩 증가한다. 이와 같이 product가 많아지면 클래스의 개수가 크게 많아지는 단점이 있다. 또한 Room1HeadGhost에 있는 useFake함수와 같이 구체적인 클래스에만 존재하는 함수를 자주 사용하게 된다면 참조변수가 Ghost이기 때문에 형변환을 자주 해줘야하는 문제점이 있다.
  11. 이상 발표를 마치겠습니다.