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

Let Typhoon use manually created objects while using blocks #12

Closed
jgongo opened this issue Mar 3, 2013 · 4 comments
Closed

Let Typhoon use manually created objects while using blocks #12

jgongo opened this issue Mar 3, 2013 · 4 comments

Comments

@jgongo
Copy link
Contributor

jgongo commented Mar 3, 2013

I've done the exercise of building a Core Data Stack using Typhoon and block style definitions. I found it extremely verbose, and I think the main reason is that Typhoon doesn't let you inject or use manually created objects. I understand this is due to the fact that you can't manually create objects in XML, but I don't see any reason why this also should be the case while using blocks.

Here you have the complete code: https://gist.github.com/jgongo/5075937

As you can see, there are four Typhoon definitions just to emulate the following snippet:

NSURL *applicationDocumentsDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSURL *storeURL = [applicationDocumentsDirectory URLByAppendingPathComponent:@"database.sqlite"];

Also notice the use of hard coded constants in applicationDocumentsDirectories

I think this could be simplified a lot if:

  1. Typhoon would let you manually create objects, not only definitions
  2. Typhoon would let you use manually created objects as factories
  3. Typhoon would let you inject manually created objects, in addition to text values and references
@jasperblues
Copy link
Member

This would be quite easy to implement. . points of interest:

  • Any manually created objects wouldn't be able to participate in the mutator system. Only definitions can.
  • Manually created objects would be "singletons"

To implement, put the manually created object into the _singleton registry. . The rest should all come out in the wash.

@jasperblues
Copy link
Member

Jeff Roberts is interested in working with you on this.

@jasperblues
Copy link
Member

Jose and Jeff -> I've granted push access (available to anyone who's first name starts with 'J' ;) ). . . Please do one of the following:

  1. Perform experimental feature development on a branch.
  2. Agree on the external API in advance.
  • Test coverage should not fall below 90%

@jasperblues
Copy link
Member

This has been completed.

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

No branches or pull requests

2 participants