java-tetro-puzzle's People
java-tetro-puzzle's Issues
Puzzle 리팩토링
원인
- Immutable하려고 하다보니 안읽히는 부분이 많아짐
발생하는 문제점
puzzle.put(block)
을 하는데 반환값이Optional<Puzzle>
인 등 어색한 부분 발생- inner class인
FitCells
의 문제점- outer class인 퍼즐의 빈 칸과 서로 연계되는 값이지만 독립적임
- Fit으로써 하는 일이 없음
- public static하므로 밖에서도 언제든 생성 가능 -> 퍼즐과 퍼즐의 채워진 칸이 따로인가?
- outer class인 퍼즐의 빈 칸과 서로 연계되는 값이지만 독립적임
- 메서드 흐름이 잘 안읽힘
- 메서드 대칭성이 없고 중구난방임
- 퍼즐에 블럭이 맞춰졌을 때 보드의 빈칸이 사라지나?
- 보드의 빈칸은 변하지 않는 값이며
- 퍼즐의 빈칸이 변하는 값이라 생각함
java-tetro-puzzle/src/main/java/tetro/Puzzle.java
Lines 10 to 90 in 3d19e5b
immutable object일 때 메서드 컨벤션
offset.difference(other);
vs Offset.difference(o1, o2);
- 프로젝트에서 일관적으로 유지하기
- 앞의 방식으로 쓰면 비슷한 패턴으로 mutable 객체를 리턴하면 안될 것 같음
- 위와 같은 경우엔 setDifference() 식으로 할까?
Cells와 Offsets 합치기
넌 지금 Offsets과 Cells를 같은 느낌으로 쓰고있어....
조짐 포인트
- 어느 순간 TDD를 미뤘다
- <구현이 아닌 인터페이스에 따라 프로그래밍 해라>를 지키지 않았다
- 예시로 자동차가 엔진 구축 방법이나 factory를 알고 있는 케이스 -> 너무 많이 알고있음
- primary object에서 object graph construction 책임을 분리하면 더 유연한 설계가 될 수 있다
- 디미터 법칙이란 걸 생각해보지 않았다
Puzzle.NonBlanks 클래스 mutable 표현
- 클래스명이 mutable한게 표현됐으면 좋겠음
java-tetro-puzzle/src/main/java/tetro/Puzzle.java
Lines 14 to 15 in 1f08e4f
java-tetro-puzzle/src/main/java/tetro/Puzzle.java
Lines 60 to 70 in 1f08e4f
BlockShape 생성은 type과 rotation으로만 결정되도록
- Offsets를 같이 넣으면 유효하지 않은 offsets이 와도 검증할 수 없음
java-tetro-puzzle/src/main/java/tetro/Block.java
Lines 24 to 27 in 1f08e4f
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.