Classes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Im reading some examples in internet about classes, and i see in some cases
that the name of the classes should be like nouns (for instance: class
person, inside namespace company, inside of another namespace called
country)...
But in another webs, i see that there are people that call to his classes
like verbs (for instance:registeruser class, or activateuser class, etc...).

Actually, i usually called my classes like nouns. Class user, class car,
class account... etc..

What do you think its the best way to have a good logic in any application?
 
Hi,

As you have seen on the web, there are plenty of different good and bad
programmers that creates funny classes names, the answer by the books is "use
nouns", if you use verbs it means that the OO design is really bad.

So, if you want to register a user, the logical way is going to the user
class and execute the method "Register", and not going to the RegisterUser
class"

public class User
{
public static void Register(..)
{}
}

Hope this helps to understand,
Salva
 
Hi Salvador,
Thanks for your fast response, its was very clear...
Kind Regards.
Josema.
 
Back
Top