556:component pattern #1233
Closed
556:component pattern #1233
Conversation
|
component/pom.xml
Outdated
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> | ||
| <version>4.12</version> |
iluwatar
May 24, 2020
Owner
You'll get this from the parent pom.xml. No need to define the version here.
You'll get this from the parent pom.xml. No need to define the version here.
| * A component is a part of one object. We can consider that a object contains multiple | ||
| * components, in another way, multiple components can construct a object. | ||
| * Here is a demo using component pattern to solve a game-like problem. | ||
| * A person named Bjorn who has three component: get input;judge physics state;show graphics state |
iluwatar
May 24, 2020
Owner
component -> components
component -> components
iluwatar
May 24, 2020
Owner
get input;judge physics state;show graphics state -> input, physics, graphics
get input;judge physics state;show graphics state -> input, physics, graphics
| * components, in another way, multiple components can construct a object. | ||
| * Here is a demo using component pattern to solve a game-like problem. | ||
| * A person named Bjorn who has three component: get input;judge physics state;show graphics state | ||
| * These three component with a common game object can construct our protagonist:Bjorn, also can |
iluwatar
May 24, 2020
Owner
component -> components
component -> components
|
|
||
| public class App { | ||
| public static void main(String[] args) { | ||
| ArrayList<Component>arrayList = new ArrayList<>(); |
iluwatar
May 24, 2020
Owner
We can use Java 11 var here to declare variables. Check elsewhere in the code too.
We can use Java 11 var here to declare variables. Check elsewhere in the code too.
| public int velocity; | ||
| public int positionOFx; | ||
| public int positionOFy; |
Comment on lines
6
to
8
iluwatar
May 24, 2020
Owner
Should be private
Should be private
| public int positionOFy; | ||
| ArrayList<Component> componentArrayList; | ||
| public GameObject(ArrayList<Component> componentArrayList){ | ||
| this.componentArrayList = componentArrayList; |
iluwatar
May 24, 2020
Owner
Instead of assigning the array I would copy the contents
Instead of assigning the array I would copy the contents
|
I will fix these problems soon. Thank you for your review. |
|
I have fixed these problems, but one thing is that for some reason I can't use the checkstyle file in the project, so I use the built-in sun checkstyle file to test. |
added 2 commits
May 30, 2020
|
Sorry for my wrong operation when I try to create a new branch to create a new pull request for another issue, I will close this one and then create two new pull requests. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Pull request description