Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a utility class be a Model class in a MVC framework?

Im designing a MVC framework but I dont know where should I put my utility classes. I read somewhere where it said utility classes are Model Classes. Is this line of thinking correct or are they some separate type of class?

like image 848
rix501 Avatar asked Aug 09 '10 04:08

rix501


1 Answers

It depends on what these Utility classes are doing. The main idea of MVC is to separate the presentation layer (V and C) from the remaining application (M). If your Utility classes handle things related to the presentational layer, place them in an appropriate package, for instance ViewHelpers or InputHandlers. If the Utility functions relate to anything else, see to which layer in your model they best fit into, for instance DataAccess Utilities go into the DAO package while a a MailHelper might go into the the Services package, and so on.

like image 188
Gordon Avatar answered Oct 28 '22 18:10

Gordon