출처: Python-Patterns  https://github.com/faif/python-patterns


python-patterns

A collection of design patterns and idioms in Python.

Current Patterns:

Pattern Description
3-tier data<->business logic<->presentation separation (strict relationships)
abstract_factory use a generic function with specific factories
adapter adapt one interface to another using a whitelist
borg a singleton with shared-state among instances
bridge a client-provider middleman to soften interface changes
builder call many little discrete methods rather than having a huge number of constructor parameters
catalog general methods will call different specialized methods based on construction parameter
chain apply a chain of successive handlers to try and process the data
command bundle a command and arguments to call later
composite encapsulate and provide access to a number of different objects
decorator wrap functionality with other functionality in order to affect outputs
facade use one class as an API to a number of others
factory_method delegate a specialized function/method to create instances
flyweight transparently reuse existing instances of objects with similar/identical state
graph_search (graphing algorithms, not design patterns)
iterator structure repeated, identical calls as a generator
mediator an object that knows how to connect other objects and act as a proxy
memento generate an opaque token that can be used to go back to a previous state
mvc model<->view<->controller (non-strict relationships)
observer provide a callback for notification of events/changes to data
pool preinstantiate and maintain a group of instances of the same type
prototype use a factory and clones of a prototype for new instances (if instantiation is expensive)
proxy an object funnels operations to something else
publish_subscribe a source syndicates events/data to 0+ registered listeners
state logic is org'd into a discrete number of potential states and the next state that can be transitioned to
strategy selectable operations over the same data
template an object imposes a structure but takes pluggable components
visitor invoke a callback for all items of a collection

ps. 조만간 디자인 패턴(Design Pattern)내용을 한글로 번역해서 정리해볼 예정

Buy me a coffeeBuy me a coffee
  • Monac님이 주최하신 애자일 3종 강탈 1탄, Head First Software Development에 당첨이 되어서 주소와 이메일, 블로그주소까지 알려주었습니다. 빨리 책이 도착하여 읽는 것만 남았음. 참고로 황금벌레님도 당첨되었으니 빨리 확인해보세요^^(me2book Head First Software Development 소프트웨어 개발 개발론 소프트웨어개발 애자일 Agile)2008-12-30 16:35:10
    Head First Software Development - 더 쉽고 재미있게 소프트웨어를 개발하는 방법
    Head First Software Development - 더 쉽고 재미있게 소프트웨어를 개발하는 방법
  • Head First Design Patterns - 스토리가 있는 패턴 학습법을 보니 소프트웨어공학때 배웠던 뜬구름 잡던 내용들이 머릿속에 정리가 잘되는 기분이 든다. 책에 있는 그램과 만화때문에 계속 책을 보게 합니다. 그러다 보니 벌써 코딩까지?(me2book Head First Design Patterns 디자인패턴 디자인 패턴 소공 소프트웨어공학 SE Software Engineering 정리)2008-12-30 22:43:12
    Head First Design Patterns - 스토리가 있는 패턴학습법
    Head First Design Patterns - 스토리가 있는 패턴학습법
  • [한빛미디어 - 기타증정] 도서가 발송처리 되었습니다. 2~3일이내 받아보실 수 있습니다.-책온다(me2sms)2008-12-31 18:30:07
  • Monaca님의 “애자일3종강탈이벤트”: http://monac.egloos.com/2186534 로 참여하여 당첨되었던 『Head First Software Development』를 택배로 받았습니다. 그런고로 인증샷 올림. 이제 빨리 읽어야지 ㅎㅎ(me2mms me2photo)2009-01-02 23:35:38

    me2photo

이 글은 StudioEgo님의 2008년 12월 30일에서 2009년 1월 2일까지의 미투데이 내용입니다.

Buy me a coffeeBuy me a coffee

MVC Pattern, originally uploaded by Dario Santarelli.

MVC(Model, View, Controller)는 게임 개발, 윈도우즈 프로그래밍 개발,웹 어플리케이션 개발등 여러군데서 많이 사용한다.
MVC패턴을 모르고서는 프로그래밍을 할수 없을 정도로 많은 기업이나 오픈소스프로젝트에서 소스의 유지보수를 위해서, 구현의 효율성을 높이기 위해서 많이 쓴다.

MVC 패턴

MVC패턴은 Smalltalk에서 그래픽 인터페이스와 실제로 동작하는 코드를 분리하기 위해 개발되었다 지금은 다른 객체지향언어에서도 널리 사용되는 패턴 중 하나이다.

웹 어플리케이션에서 사용하는 MVC 패턴
MVC 패턴의 기본 개념은 사용자에게 보일 페이지(View)와 데이터 처리(Model), 그리고 이들 상호간의 흐름을 제어(Controller)하는 모듈을 분리하는 것이다. 이렇게 함으로 더 쉽게 웹 애플리케이션을 확장하고 유지, 보수를 할 수 있다.
(여기서는 JAVA Web 개발에 관한 MVC 패턴을 다룬다)

모델(Model)
모델(model)이란 어떠한 동작을 수행하는 코드를 말한다. 표시 형식에 의존하지 않는다. 다시 말해, 사용자에게 어떻게 보여질지에 대해 신경쓰지 않아도 된다. 모델은 순수하게 public 함수로만 이루어진다. 몇몇의 함수들은 사용자의 질의(query)에 대해 상태 정보를 제공하고 나머지 함수들은 상태를 수정하는 함수이다.

웹어플리케이션에서 모델(Model)은 데이터 영역으로 DAO(Data Access Object), DO(Data Object) 등으로 구분해 구현하기도 한다. 하이버네이트, 아이바티스와 같은 퍼시스턴스 프레임워크를 사용하기도 한다. EJB와 연동할 수 있으며 EJB 3.0의 POJO 기반의 퍼시스턴스 API도 있다.


뷰(View)
MVC에서 모델은 여러 개의 뷰(view)를가질 수 있다. 뷰는 모델에게 질의를 하여 모델로 부터 값을 가져와 사용자에게 보여준다.
웹어플리케이션에서 뷰(View)는 JSP를 기본으로 표현 언어, JSTL, 커스텀 태그 라이브러리 등을 함께 사용하며, 모듈화 된 사용자 인터페이스 모델인 JSF(Java Server Faces)도 이용할 수 있다.


컨트롤러(Controller)
MVC의 뷰는 여러 개의 컨트롤러(Controller)를 가지고 있다. 사용자는 컨트롤러를 사용하여 모델의 상태를 바꾼다. 컨트롤러는 모델의 mutator 함수를 호출하여 상태를 바꾼다. 이 때 모델의 상태가 바뀌면 모델은 등록된 뷰에 자신의 상태가 바뀌었다는 것을 알리고 뷰는 거기에 맞게 사용자에게 모델의 상태를 보여 준다.
웹어플리케이션에서 컨트롤러(Controller)는 MVC 패턴의 중심이 되는 부분으로, 직접 구현하거나 구현된 솔루션을 이용할 수 있다. 대표적으로 스트러츠 프레임워크(struts Framework)나 스프링 프레임워크(Spring Framework)가 있다.

'컴퓨터 > 프로그래밍' 카테고리의 다른 글

Android SDK 설치  (0) 2008.12.14
오랜만에 만져본 JAVA  (2) 2008.12.02
내가 보아야 할 Ruby 관련 책들  (2) 2008.05.14
Ruby를 맛봅시다.  (2) 2008.04.30
10.Raw Socket  (0) 2008.04.29
Buy me a coffeeBuy me a coffee

+ Recent posts