ios - Naming pattern for the class used by your ViewControllers and contains the business logic -
i see lot of folks (including apple's sample code) putting of business logic in viewcontroller classes. however, in effort create lighter view-controllers, want put business logic own class, encapsulation, separation of concerns, , unit testability intended side-effects effort.
but what's naming convention use these kinds of classes hold business/application logic , used uiviewcontroller derived class?
hypothetically, let's have poker game class called gamedetailviewcontroller. of business logic of show or whether move valid or not placed in separate class, used gamedetailviewcontroller.
what's name it? i've seen term "service" , "manager" appended class name. there better term?
- gamedetailservice?
- gamedetailmanager?
the problem 'service' it's overloaded whatever remote (aka cloud) service you'd talking to. manager: eh.. becomes manager , manage?
i design patterns way @ loss find name.
i name does, if validating hands, seems me gamelogic.h, way easy read in view controller when call [gamelogic isvalid:hand];
or [gamelogic is:hand1 greaterthan:hand2];
. makes sense me. , seems obvious when need ask question game logic, know put it.
Comments
Post a Comment