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

2660 extract storage take4 #2775

Merged
merged 90 commits into from
Mar 18, 2015
Merged

2660 extract storage take4 #2775

merged 90 commits into from
Mar 18, 2015

Conversation

rafatower
Copy link
Contributor

Another version, without access to user_table. table.user_table.* is no longer permitted.

This was done to avoid exposing functionality of the model through the Table service/decorator/façade, as Nacho suggested. Why? I tried two different approaches:

  • Keeping the same interface for Table. Almost imposible because of the richness of the Sequel::Model, Sequel::Dataset and related classes.
  • Keeping UserTable as dumb and ignorant as possible. Not fully possible, cause many business rules are implemented through hooks.
  • Exposing UserTable functionality directly to client classes. Although it sounded like a good idea at first, this way it is hard to enforce certain business rules (such as setting a table name) without a complex interaction between Table and UserTable.

So finally this is the best design I could come up having something working.

If I were to refactor this again, I'd probably take a different approach: do not try to fully isolate the model but extract pieces of functionality little by little and assuming the Model would still be the "director" of the interactions. Start with value objects and continue with a UserData service or similar.

  • Pros: easier and safer to carry on, less radical.
  • Cons: harder to get an isolated model, which is bad for porting to ActiveRecord.

Cc'ing @Kartones @juanignaciosl and @javisantana so that you have something funny to review when you get to work on Monday :)

Have a nice weekend!

Rafa de la Torre added 30 commits March 10, 2015 16:02
@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@@ -217,7 +217,7 @@ def public_map
@user_domain = user_domain_variable(request)

@public_tables_count = @visualization.user.public_table_count
@nonpublic_tables_count = @related_tables.select{|p| p.privacy != ::Table::PRIVACY_PUBLIC }.count
@nonpublic_tables_count = @related_tables.select{|p| p.privacy != ::UserTable::PRIVACY_PUBLIC }.count
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot changing this check as you've done in the following lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d6c3efa

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@rafatower
Copy link
Contributor Author

retest this, please

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@rafatower
Copy link
Contributor Author

retest this, please

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@rafatower rafatower changed the title 2660 extract storage take4 [do NOT merge yet] 2660 extract storage take4 [in testing] Mar 17, 2015
@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

rafatower pushed a commit that referenced this pull request Mar 18, 2015
2660 extract storage take4 [in testing]
@rafatower rafatower merged commit 4310249 into master Mar 18, 2015
@rafatower rafatower changed the title 2660 extract storage take4 [in testing] 2660 extract storage take4 Mar 18, 2015
@elenatorro elenatorro deleted the 2660-extract-storage-take4 branch February 16, 2018 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants