Giter Site home page Giter Site logo

oop-start's Introduction

🚀 OOP START!

2022년의 마지막날 YOUTHCON'22 OOP START! 세션과 함께해요 🙌

🤔 무엇을 하나요

절차 지향으로 작성된 자바 어플리케이션을 객체 지향으로 리팩터링해보면서 객체 지향의 필요성을 느껴봅니다!

🙆‍♂️ 이런 분들께 추천드려요

✔️ 절차 지향적으로 코드를 작성해온 분

✔️ Getter, Setter 없이 코딩하기 힘든 분

✔️ 객체지향을 학습할 분 또는 학습하고 계신 분

객체 지향 프로그래밍이란?

https://i.ytimg.com/vi/dy9yQIx38u8/maxresdefault.jpg

변경을 캡슐화한 객체들이 메시지를 통해 협력하는 프로그래밍입니다. 객체 지향 프로그래밍을 통해 변경에 유연한 코드를 작성할 수 있고 유지보수성이 좋아져요 👍

📚 이런 걸 배워요

✅ 객체 지향 창시자가 말한 객체 지향의 3요소

✅ 객체 지향의 협력, 책임, 역할

✅ 객체 지향에서 말하는 캡슐화와 다형성

🎞️ 실습 시나리오

🚚 주문 기능

Part 0 절차 지향

  • 주문에는 구매할 상품과 고객이 필요하다.
  • 상품 주문이 들어오면 상품 재고를 1 감소시킨다.
    • 상품의 재고가 1개 이상일때만 주문이 가능하다.
  • 상품 가격만큼 고객의 기프트 카드의 보유액을 감소시킨다.
    • 기프트 카드 보유액은 음수가 될 수 없다.

Part 1 메시지

  • 메시지 개선

Part 2 정보 전문가

  • 책임 할당

Part 3 의도를 드러내는 인터페이스

  • 상품 최소 재고 10개로 변경

  • 상품 최소 재고 5개로 변경.

Part 4 묻지 말고 시켜라

  • 상품 판매시 가격이 1000원 이하면 상품 판매가 불가능하도록 조건 추가

Part 5 메서드 캡슐화

  • 재고 감소 로직을 캡슐화

Part 6 객체 캡슐화

  • 기프트 카드와 포인트를 캡슐화

Part 7 다형성

  • 포인트 결제 추가

Part 8 상속

  • 중복 코드를 제거

📝 기술 스택은 아래와 같습니다

  • Java 11
  • Gradle 7.5.1
  • AssertJ 3.23.1

oop-start's People

Contributors

wenodev avatar yunsik-choi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

oop-start's Issues

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.