Welcome Guest, Not a member yet? Register   Sign In
Can I duplicate class names?
#1

[eluser]kimp[/eluser]
Hi,

I'm aiming to use the full MVC pattern, and adhere to the DRY principle.

I've got several different types of users including Public and Admin, and I've set up a directory for the controllers for each user type.

In some cases I want them to be able to do similar - but not identical - things. For example, in the case of user CRUD:

- Public can Add a user; while
- Admin can Add, List, Edit and Delete users.

I would like to name the controllers (and therefore the classes) the same. i.e.:

- controllers/public/users.php
- controllers/admin/users.php

Does this violoate any design principles?

I am making the controllers as light as possible, so any duplication (and DRY violation) will be minimal.

Your comments are much appreciated!

Kim
#2

[eluser]danmontgomery[/eluser]
They can be named the same thing, they just can't both be instantiated at the same time.




Theme © iAndrew 2016 - Forum software by © MyBB