naming-conventions

Is naming variables after their type a bad practice?

余生长醉 提交于 2019-12-02 20:51:58
I'm programming C++ using the underscore naming style (as opposed to camel case) which is also used by the STL and boost. However, since both types and variables/functions are named all lower case, a member variable declaration as follows will lead to compiler errors (or at least trouble): position position; A member variable named position which is of type position . I don't know how else to name it: It's generally a position , but it is also the position of the object. In camel case, this would be fine with the compiler: Position position; But in C++ it causes problems. I don't want to

Naming conventions: Guidelines for verbs/nouns and english grammar usage

谁说胖子不能爱 提交于 2019-12-02 20:41:20
Can anyone point me to a site, or give me some wisdom on how you go about choosing names for interfaces, classes and perhaps even methods and properties relating to what that object or method does? This is specifically for Microsoft development, so Java-esque "doGet" and so on isn't really used, however some general rules that cross language barriers must (I would've thought) exist. An example might help: I have 4 choices of names for an interface: IGroupedItem IGroupableItem IDataEntity IGroupedEntity They all contain an adjective and the noun, or just a noun. Looking at the .NET framework it

MySQL column name standards / conventions [closed]

六眼飞鱼酱① 提交于 2019-12-02 20:28:36
Closed . This question is opinion-based. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . I'm looking for document (suggestions) with column name standards or conventions for MySQL. Can anybody suggest any? There's nothing "standard" in this space I'm aware of, unlike say Sun's old Java conventions. Anything you adopt will be personal/company preference. That said, I do like prefix conventions: t_ for table v_ for view idx_ for index tx_ for text field dt_ for date field

How should I name a java.util.Map? [closed]

丶灬走出姿态 提交于 2019-12-02 19:54:29
Closed . This question is opinion-based. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . I have a java.util.Map that maps from a logical name to a set of parameters to use with that name. Map<String,Parameters> howShouldINameThee = ...; What is the best name for this map? Should I go simple and just call this parameters or parametersMap ? Do I include information about the key in the name like paramtersByName so that how to use the String key is more obvious? A Map maps

Why prefix C# interface names with an “I”

不问归期 提交于 2019-12-02 19:08:28
What is the rationale behind this naming convention? I don't see any benefit. The extra prefix just pollutes the API. My thinking is inline with Konrad's response to this related question ; the chosen answer of which is mostly what I am asking for here. Its the complete opposite, the naming convention clearly identifies an interface. For example if you have: public class Dog : IPet, IMammal { .... Just from reading it, I can safely assume that IPet and IMammal are probably interfaces. The .NET CLR allows for single class inheritance. So, if I have a base class..I can only inherit one class

What's the convention for using an asterisk at the end of a function name in Clojure and other Lisp dialects?

冷暖自知 提交于 2019-12-02 19:04:18
Note that I'm not talking about ear muffs in symbol names, an issue that is discussed at Conventions, Style, and Usage for Clojure Constants? and How is the `*var-name*` naming-convention used in clojure? . I'm talking strictly about instances where there is some function named foo that then calls a function foo*. In Clojure it basically means "foo* is like foo, but somehow different, and you probably want foo". In other words, it means that the author of that code couldn't come up with a better name for the second function, so they just slapped a star on it. Mathematicians and Haskellers can

Database name convention: DATETIME column

别来无恙 提交于 2019-12-02 19:01:42
What is your naming convention for DATETIME columns (in my case, using MS SQL Server) For a column that stores when the row was created CreatedDatetime makes sense, or LastModifiedDatetime . But for a simple table, let's say one called Event, would you create columns called: EventID, // Primary key EventDatetime, // When the event is happening EventEnabled // Is the event is on or ID, // Primary key Datetime, // When the event is happening Enabled // Is the event is on If you'd use neither convention: Please provide the column name you would use. I normally name DATETIME columns as ACTION_WORD

Haskell module naming conventions

我是研究僧i 提交于 2019-12-02 18:52:37
How should I name my Haskell modules for a program, not a library , and organize them in a hierarchy ? I'm making a ray tracer called Luminosity. First I had these modules: Vector Colour Intersect Trace Render Parse Export Each module was fine on it's own, but I felt like this lacked organization. First, I put every module under Luminosity , so for example Vector was now Luminosity.Vector (I assume this is standard for a haskell program?). Then I thought: Vector and Colour are independent and could be reused, so they should be separated. But they're way too small to turn into libraries. Where

Are classes in Python in different files?

浪子不回头ぞ 提交于 2019-12-02 18:52:02
Much like Java (or php), I'm use to seperating the classes to files. Is it the same deal in Python? plus, how should I name the file? Lowercase like classname.py or the same like ClassName.py? Do I need to do something special if I want to create an object from this class or does the fact that it's in the same "project" (netbeans) makes it ok to create an object from it? Felix Kling In Python, one file is called a module . A module can consist of multiple classes or functions. As Python is not an OO language only, it does not make sense do have a rule that says, one file should only contain

Naming convention JUnit suffix or prefix Test [closed]

巧了我就是萌 提交于 2019-12-02 18:42:53
Class under test MyClass.java JUnit test case name alternatives: TestMyClass.java MyClassTest.java http://moreunit.sourceforge.net seems to use "Test" as prefix default but I have seen both uses. Both seems to be recognized when running the entire project as unit test in eclipse as it is the annotation inside classes that are parsed for @Test. I guess maven does the same thing. Which is preferred? Another argument for suffix - at least in english language: A class usually represents a noun , it is a model of a concept. An instance of one of your tests would be a 'MyClass test'. In contrast, a