Skip to content

Commit

Permalink
Hide The Board's Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ClayDowling committed Apr 15, 2017
1 parent 535b901 commit 4d189dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ The engine tests have been converted. Notice that they still take advantage of


Engine is the last class which was using the internal representation of the LifeBoard. Now it's converted to use only the defined interfaces. Engine is the last class which was using the internal representation of the LifeBoard. Now it's converted to use only the defined interfaces.


By passing the LifeBoard to the constructor of the engine, I'm also removing the dependency on the static implementation of the board's storage. I verified that by removing the static storage class in LifeBoard. By passing the LifeBoard to the constructor of the engine, I'm also removing the dependency on the static implementation of the board's storage. I verified that by removing the static storage class in LifeBoard.

## Hide The Board's Implementation

I can now hide the implementation of the board and all tests still pass. This opens the way to change the actual implementation.
3 changes: 1 addition & 2 deletions src/main/java/LifeBoard.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
public class LifeBoard implements Board { public class LifeBoard implements Board {
public static final int X_MAX = 50; public static final int X_MAX = 50;
public static final int Y_MAX = 50; public static final int Y_MAX = 50;
public boolean[][] value = new boolean[X_MAX][Y_MAX]; private boolean[][] value = new boolean[X_MAX][Y_MAX];



public void clear() { public void clear() {
for(int x=0; x < X_MAX; ++x) { for(int x=0; x < X_MAX; ++x) {
Expand Down

0 comments on commit 4d189dc

Please sign in to comment.