★ wanayoo — archive 1999 https://github.com/iluwatar/java-design-patterns/pull/1233Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

556:component pattern #1233

Closed
wants to merge 45 commits into from
Closed

556:component pattern #1233

wants to merge 45 commits into from

Conversation

@Hrighter
Copy link

@Hrighter Hrighter commented May 6, 2020

Pull request description

  • for issue: #556
  • create a component pattern demo
Hrighter added 9 commits May 6, 2020
Copy link
Owner

@iluwatar iluwatar left a comment

  • Component pattern needs to be added to main pom.xml as a module to be included in the build
  • There are Checkstyle errors failing the build currently
  • The package name should be com.iluwatar instead of com.iluwater
component/README.md Outdated Show resolved Hide resolved
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>

This comment has been minimized.

@iluwatar

iluwatar May 24, 2020
Owner

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

This comment has been minimized.

@iluwatar

iluwatar May 24, 2020
Owner

component -> components

This comment has been minimized.

@iluwatar

iluwatar May 24, 2020
Owner

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

This comment has been minimized.

@iluwatar

iluwatar May 24, 2020
Owner

component -> components


public class App {
public static void main(String[] args) {
ArrayList<Component>arrayList = new ArrayList<>();

This comment has been minimized.

@iluwatar

iluwatar May 24, 2020
Owner

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

This comment has been minimized.

@iluwatar

iluwatar May 24, 2020
Owner

Should be private

public int positionOFy;
ArrayList<Component> componentArrayList;
public GameObject(ArrayList<Component> componentArrayList){
this.componentArrayList = componentArrayList;

This comment has been minimized.

@iluwatar

iluwatar May 24, 2020
Owner

Instead of assigning the array I would copy the contents

Hrighter added 8 commits May 24, 2020
@Hrighter
Copy link
Author

@Hrighter Hrighter commented May 24, 2020

I will fix these problems soon. Thank you for your review.

Hrighter added 10 commits May 24, 2020
Hrighter added 16 commits May 24, 2020
@Hrighter
Copy link
Author

@Hrighter Hrighter commented May 24, 2020

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.

@Hrighter
Copy link
Author

@Hrighter Hrighter commented 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.

@Hrighter Hrighter closed this May 30, 2020
@iluwatar iluwatar added this to the 1.23.0 milestone May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.