hidden-username
hidden-username

Reputation: 2697

iOS MVC Model Naming Convention

Is there a standard convention for naming Model classes? I looked at Apple's conventions, but I really couldn't find an answer, if there is one. Views are usually prefixed with UI and/or contain view in the name; controllers usually post-fix "controller," but I'm not sure how to name my model classes. I've seen Manager, but usually these are singletons.

Upvotes: 0

Views: 1517

Answers (1)

nburk
nburk

Reputation: 22731

Model classes typically represent objects of the real world, so you'll just name them exactly like those, a few examples:

Car User Animal House

Note that Model classes are essentially there to provide a logical component of your app's application domain.

You can give prefixes to your classes so that their namespaces don't interfere with classes that come from other projects or frameworks where they might have been named identically. Also, the prefixes that Apple uses usually indicate the framework that these classes come from (although this is not always the case), like UIViewController, UIButton, UILabel etc coming from UIKit.

Upvotes: 1

Related Questions