★ wanayoo — archive 1999 https://github.com/iluwatar/java-design-patterns/pull/1228Nouvelle 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

Create association table mapping pattern. #1228

Closed
wants to merge 1 commit into from

Conversation

@LeonoraGy
Copy link

@LeonoraGy LeonoraGy commented Apr 27, 2020

Association Table Mapping pattern.

  • Implement association table mapping pattern
  • refer to issue #347

For detailed contributing instructions see https://github.com/iluwatar/java-design-patterns/wiki/01.-How-to-contribute

@LeonoraGy LeonoraGy force-pushed the LeonoraGy:associationtablemapping branch from c52197a to 74705c4 Apr 27, 2020
categories: Patterns of Enterprise Application Architecture, Object-Relational Structural
tags:
- Decoupling
- many-to-many
Comment on lines +6 to +9

This comment has been minimized.

@iluwatar

iluwatar May 16, 2020
Owner

I would suggest picking categories and tags from the pre-existing ones. My suggestion for category is Idiom since this is small pattern. For tags I would suggest Enterprise Integration Pattern and Data access.
See https://github.com/iluwatar/java-design-patterns/wiki/07.-Categories-and-Tags

StudentTableImpl studentTable = new StudentTableImpl();
CourseTableImpl courseTable = new CourseTableImpl();
Comment on lines +44 to +45

This comment has been minimized.

@iluwatar

iluwatar May 16, 2020
Owner

With Java 11 you can use var keyword to declare the variables

This comment has been minimized.

@iluwatar

iluwatar May 16, 2020
Owner

I won't mention this again but check that throughout the code


package com.iluwatar.associationtable;

class AssociationTable {

This comment has been minimized.

@iluwatar

iluwatar May 16, 2020
Owner

It's good practice to add Javadoc to classes that explains their purpose

*/
static void contentOfTable() {
if (AssociationTable.associations == null || AssociationTable.associations.length == 0) {
System.out.println("The table is empty!");

This comment has been minimized.

@iluwatar

iluwatar May 16, 2020
Owner

We should use a proper logger when outputting something. See the other patterns for examples.

* Storing the associations between Course and Student table,
* using the id of the objects.
*/
static int[][] associations;

This comment has been minimized.

@iluwatar

iluwatar May 16, 2020
Owner

The multidimensional array data structure seems awfully clumsy in this case. It makes the handling code complex and verbose. Could you think of a better alternative here?

@iluwatar
Copy link
Owner

@iluwatar iluwatar commented May 16, 2020

@LeonoraGy I've added my review comments. Let me know when it's ready for another look.

@iluwatar iluwatar self-assigned this May 17, 2020
@LeonoraGy LeonoraGy closed this Jul 7, 2020
@iluwatar iluwatar added this to the 1.23.0 milestone Jul 7, 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.