473,516 Members | 3,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Classes

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?

--
Thanks
Regards.
Josema
Nov 17 '05 #1
2 1576
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

"Josema" wrote:
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?

--
Thanks
Regards.
Josema

Nov 17 '05 #2
Hi Salvador,
Thanks for your fast response, its was very clear...
Kind Regards.
Josema.

"Salvador" wrote:
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

"Josema" wrote:
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?

--
Thanks
Regards.
Josema

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
741
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a managed point-of-view I've noticed that: 1) for each managed and unmanaged C function (not C++ classes) I get a public managed static method...
9
1630
by: Jack | last post by:
Hello I have a library of calculationally intensive classes that is used both by a GUI based authoring application and by a simpler non-interactive rendering application. Both of these applications need to serialise the classes to/from the same files but only the GUI app needs the full range of class methods. Now, the rendering app needs...
9
6627
by: Aguilar, James | last post by:
I know that one can define an essentially unlimited number of classes in a file. And one can declare just as many in a header file. However, the question I have is, should I? Suppose that, to use the common example, I have a situation where I am implementing many types of Shapes. My current way of thinking is, well, since they are all...
12
21203
by: Langy | last post by:
Hello I'm fairly new to C++ but have programmed several other languages and found most of c++ fairly easy (so far!). I've come to a tutorial on classes, could someone please tell me why you would need to use a class? Perhaps you could also give an example on when it might be used rather than an alternative method.
4
1800
by: john townsley | last post by:
do people prefer to design classes for the particular job or for a rangle of tasks they might encounter now and in the future. i am doing some simple win32 apps and picking classes is simple, but understanding others peoples logic isnt (that doesnt mean they are wrong). i prefer designing classes for the currect job and making tangible...
2
9480
by: joye | last post by:
Hello, My question is how to use C# to call the existing libraries containing unmanaged C++ classes directly, but not use C# or managed C++ wrappers unmanaged C++ classes? Does anyone know how to do that? Thanks. Tsung-Yu
18
2018
by: Edward Diener | last post by:
Is the packing alignment of __nogc classes stored as part of the assembly ? I think it must as the compiler, when referencing the assembly, could not know how the original data is packed otherwise. Yet, in my understanding, attributes are only __gc and __value class specific and do not apply to __nogc classes. Is this correct ? If so, how is...
6
2919
by: ivan.leben | last post by:
I want to write a Mesh class using half-edges. This class uses three other classes: Vertex, HalfEdge and Face. These classes should be linked properly in the process of building up the mesh by calling Mesh class functions. Let's say they point to each other like this: class Vertex { HalfEdge *edge; }; class HalfEdge { Vertex* vert;
0
2018
by: ivan.leben | last post by:
I am writing this in a new thread to alert that I found a solution to the problem mentioned here: http://groups.google.com/group/comp.lang.c++/browse_thread/thread/7970afaa089fd5b8 and to avoid this topic getting lost before people interested in the problem notice it. The important tricks to the solution are two: 1) make the custom classes...
2
1901
by: Amu | last post by:
i have a dll ( template class) ready which is written in VC++6. But presently i need to inherit its classes into my new C#.net project.so if there is some better solution with u then please give me the solution.
0
7273
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7405
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7547
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3265
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3252
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1620
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.