Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Class naming convention: Is it BaseClass or ClassBase or AbstractClass

People also ask

C dalam Latin berapa?

C adalah huruf ketiga dalam alfabet Latin. Dalam bahasa Indonesia, huruf ini disebut ce (dibaca [tʃe]).

Bahasa C digunakan untuk apa?

Meskipun C dibuat untuk memprogram sistem dan jaringan komputer namun bahasa ini juga sering digunakan dalam mengembangkan software aplikasi. C juga banyak dipakai oleh berbagai jenis platform sistem operasi dan arsitektur komputer, bahkan terdapat beberepa compiler yang sangat populer telah tersedia.

Apakah C termasuk bahasa pemrograman?

Bahasa C atau dibaca “si” adalah bahasa pemrograman tingkat tinggi dan general-purpose yang digunakan dalam sehari-hari. Maksud dari general-purpose adalah bisa digunakan untuk membuat program apa saja.

Bahasa C dibuat pertama kali oleh siapa dan tahun berapa?

Bahasa pemrograman C ini dikembangkan antara tahun 1969 – 1972 oleh Dennis Ritchie. Yang kemudian dipakai untuk menulis ulang sistem operasi UNIX. Selain untuk mengembangkan UNIX, bahasa C juga dirilis sebagai bahasa pemrograman umum.


There are examples in the Framework with the Base suffix, e.g. System.Configuration.Provider.ProviderBase, System.Web.SessionState.SessionStateStoreProviderBase.

But by no means all abstract base classes in the Framework follow this convention (e.g. System.Data.Common.DbParameter, System.Data.Common.DbCommand).

Personally I would avoid using the suffix unless I wanted to emphasize the fact that it's an abstract class and felt that otherwise users of the class might expect the name to indicate a concrete implementation.


None of the above. Consider what purpose your base class provides; name it that. For example, the base class of Automobile and Bicycle could be Vehicle.

If you're creating base classes just to have a base class of one class, and with no purpose or reason other than that, you're probably doing something wrong.


If you're talking about virtual base classes, Microsoft's standard is ClassnameBase (like CollectionBase.)


We use BaseEntity, but I think it your own preference. I frequently see the other.

Just be consistent within your context, be that your project, namespace or if possible, your team. Different conventions are worse than a bad convention IMHO.


I think its a matter of choice. I'd say if you are creating a lot of base classes then perhaps it is better to go with BaseClassname always because that way you can ALWAYS find out what base classes you can start using by just typing Base and getting the rest of the help from Intellisense. What if you had 20 Base classes and you added Base as suffix and you forgot what was the name of the base class? Do you want to create a class diagram first from VS and find out what base classes are available? It's alright to name them ClassBase when it is just one or two classes.

Same goes for decision between GetItems and ItemsGet function. I'd say for readability's sake atleast - go for GetItems. Follow the conventions :)