Take the 2-minute tour ×

I have recently inherited a CoreData project from an outside developer. Where I expected to find all my auto-generated NSManagedObject sub-classes, I instead have (what some googling reveals to be) classes generated by Mogenerator, a tool that I have no experience with.

I understand that the purpose of using this tool is to make it so that you can add custom code into the classes corresponding to the CoreData entities without worrying about it being lost when the model changes and the classes are regenerated... but I can do this anyways by using categories.

I currently do not see a real advantage to using Mogenerator over categories.

What are the advantages/disadvantages of using Mogenerator vs. categories? Does Mogenerator serve any additional purposes?

share|improve this question

2 Answers 2

up vote 8 down vote accepted

An advantage of using classes vs categories, is that you can extend functionality by subclassing and overriding.

For instance, if your model has subentities, it is possible for them to inherit functionality from a common master class. Subclasses could define specific behavior by overriding the desired methods. On the other hand, it is possible to override methods defined in categories, but it is not recommended. This means logic implemented as categories would have to be repeated in every subclass.

A lot of code in managed objects is boilerplate, so it's really nice to have mogenerator do it automatically.

share|improve this answer

From their 'site' http://rentzsch.github.com/mogenerator/ :

mogenerator generates Objective-C code for your Core Data custom classes

Unlike Xcode, mogenerator manages two classes per entity: one for machines, one for humans

The machine class can always be overwritten to match the data model, with humans’ work effortlessly preserved

So basically it got nothing to do with categories. Mogenerator (Model Object Generator) generates code which you've seen the results from in the project you've gotten handed over.

share|improve this answer

Your Answer


