Giter VIP home page Giter VIP logo

design-pattern-study's Introduction

design-pattern-study

πŸ“– 'μŠ€ν”„λ§ μž…λ¬Έμ„ μœ„ν•œ μžλ°” 객체 지ν–₯의 원리와 이해' 의 'μŠ€ν”„λ§μ΄ μ‚¬λž‘ν•œ λ””μžμΈ νŒ¨ν„΄'을 κ³΅λΆ€ν•˜κ³  μ •λ¦¬ν•œ λ ˆν¬μž…λ‹ˆλ‹€.

λ””μžμΈ νŒ¨ν„΄μ΄λž€?

  • μš”λ¦¬λ‘œ λΉ„μœ ν•˜μžλ©΄, ν‘œμ€€ν™”λœ μš”λ¦¬λ²•
  • λ§Žμ€ κ°œλ°œμžλ“€μ΄ κ³ λ―Όν•˜κ³  μ •μ œν•œ 사싀 μƒμ˜ ν‘œμ€€ 섀계 νŒ¨ν„΄
  • μ‹€μ œ 개발 ν˜„μž₯μ—μ„œ λΉ„μ¦ˆλ‹ˆμŠ€ μš”κ΅¬ 사항을 ν”„λ‘œκ·Έλž˜λ°μœΌλ‘œ μ²˜λ¦¬ν•˜λ©° λ§Œλ“€μ–΄μ§„ λ‹€μ–‘ν•œ ν•΄κ²°μ±… 쀑 λ§Žμ΄λ“€ μΈμ •ν•œ best practiceλ₯Ό μ •λ¦¬ν•œ 것
  • 객체 지ν–₯ νŠΉμ„±κ³Ό 섀계 원칙을 기반으둜 κ΅¬ν˜„λ¨
  • μŠ€ν”„λ§μ—μ„œμ˜ λ””μžμΈ νŒ¨ν„΄λ“€ β†’ μžλ°” μ—”ν„°ν”„λΌμ΄μ¦ˆ κ°œλ°œμ„ νŽΈν•˜κ²Œ ν•΄μ£ΌλŠ” μ˜€ν”ˆμ†ŒμŠ€ κ²½λŸ‰κΈ‰ μ• ν”Œλ¦¬μΌ€μ΄μ…˜ ν”„λ ˆμž„μ›Œν¬ (μŠ€ν”„λ§ ν”„λ ˆμž„μ›Œν¬ = OOP ν”„λ ˆμž„μ›Œν¬)
    • μŠ€ν”„λ§μ—μ„œ μ‹œμž‘ν•΄ 객체 지ν–₯으둜 ν–₯ν•˜λŠ” ν•˜ν–₯식(Top-Down),
    • 객체 지ν–₯μ—μ„œ μ‹œμž‘ν•΄ μŠ€ν”„λ§μœΌλ‘œ ν–₯ν•˜λŠ” 상ν–₯식(Bottom-up)
  • λ””μžμΈ νŒ¨ν„΄μ€ 객체 지ν–₯ νŠΉμ„± 쀑 상속(extends), μΈν„°νŽ˜μ΄μŠ€(interface/implements), ν•©μ„±(객체λ₯Ό μ†μ„±μœΌλ‘œ μ‚¬μš©)을 μ΄μš©ν•œλ‹€.

μ–΄λŒ‘ν„° νŒ¨ν„΄

public class ServiceA {
    void runServiceA() {
    }
}

public class ServiceB {
    void runServiceB() {
    }
}
public class AdapterServiceA {
    ServiceA s1 = new ServiceA();

    void runService() {
        s1.runServiceA();
    }
}

public class AdapterServiceB {
    ServiceB sB = new ServiceB();

    void runService() {
        sB.runServiceB();
    }
}
// μ–΄λŒ‘ν„° νŒ¨ν„΄ 적용 μ „
public class ClientWithNoAdapter {
    public static void main(String[] args) {
        ServiceA sA = new ServiceA();
        ServiceB sB = new ServiceB();

        sA.runServiceA();
        sB.runServiceB();
    }
}

// μ–΄λŒ‘ν„° νŒ¨ν„΄ 적용 ν›„
public class ClientWithAdapter {
    public static void main(String[] args) {
        AdapterServiceA asa1 = new AdapterServiceA();
        AdapterServiceB asb1 = new AdapterServiceB();

        asa1.runService();
        asb1.runService();
    }
}

design-pattern-study's People

Contributors

yebinleee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.