naming-conventions

The C# namespace and class/sub-class naming conventions when the top namespace contains the base class and inner namespaces contain sub-classes

时光总嘲笑我的痴心妄想 提交于 2019-12-04 11:19:46
问题 I'm trying to design a class library for a particular engineering application and I'm trying to ensure that my class & namespace naming conventions make sense. I have the following situation: namespace Vehicle{ class Wheel{...} //base class for Wheel objects class Engine{...} //base class for Engine objects ... namespace Truck{ class Wheel: Vehicle.Wheel{...} //Truck specific Wheel object class Engine: Vehicle.Engine{...} //Truck specific Engine object ... } namespace Car{ class Wheel:

Which abbreviations should we use for python variable names?

不羁岁月 提交于 2019-12-04 11:02:02
问题 In generally I'm using the standard naming stated in PEP-8 for variables. Like: delete_projects connect_server However sometimes I can't find any good name and the name just extend to a long one: project_name_to_be_deleted I could use pr_nm_del , but this makes the code unreadable. I'm really suffering finding good variable names for functions. Whenever I begin to write a new function I just spent time to find a good variable name. Is there any standard for choosing certain abbreviations for

Entity Framework 6.1.1 Naming Convention for indexes

谁说胖子不能爱 提交于 2019-12-04 10:53:19
I understand how to add conventions to the code first (with migrations) project. I have successfully managed to perform the table names and even changed GUID Id fields to non-clustered. But I have not found how to change the default index name that EF supplies when no name is given. [Index(IsUnique = true)] public string Code { get; set; } [Index] public string Description { get; set; } I have these two requirements. The top index should be named UX_[schema]_[table]_Code , the second IX_[schema]_[table]_Description I also have the need to support multiple column indexes where IsUnique will

Independent getter/setter methods, or combined?

雨燕双飞 提交于 2019-12-04 10:23:12
问题 While working on a project, I've been making some changes and browsing around existing framework API docs for insight. While perusing the Kohana docs, I noticed that the getters/setters of any given class are typically combined: public function someProperty($value = null){ if(is_null($value){ return $this->_someProperty; } $this->_someProperty = $value; return $this; } Rather than: public function setSomeProperty($value){ $this->_someProperty = $value; return $this; } public function

What 1-2 letter object names conflict with existing R objects?

对着背影说爱祢 提交于 2019-12-04 10:18:01
问题 To make my code more readable, I like to avoid names of objects that already exist when creating new objects. Because of the package-based nature of R, and because functions are first-class objects, it can be easy to overwrite common functions that are not in base R (since a common package might use a short function name but without knowing what package to load there is no way to check for it). Objects such as the built-in logicals T and F also cause trouble. Some examples that come to mind

How to build executable with name other than Golang package

我是研究僧i 提交于 2019-12-04 09:06:51
问题 Is it possible to build (install, go get, etc) an executable with the name foobar if my Golang package name is one of the following: github.com/username/go-foobar github.com/username/foobar-tools and has main.go in the package root? 回答1: You can specify the executable name using the -o switch with go build . For your example it would look something like: cd $GOPATH/github.com/username/go-foobar && go build -o foobar . However, you're just left with the executable in the package's folder --

Use of special characters in function names

余生颓废 提交于 2019-12-04 08:55:56
问题 In Ruby, a standard convention is to use a question mark at the end of a method name to indicate the method returns a boolean result: [].empty? #=> true Another standard convention is to end a method name with an exclamation point if the method is destructive (that is, it modifies the original data): mylist.sort! # sort mylist in-place Recently I have seen these same conventions used in Scheme. Which makes me wonder, what other languages use/support this convention? Are there any other

Conflicts between member names and constructor argument names [duplicate]

橙三吉。 提交于 2019-12-04 08:33:06
Possible Duplicate: Members vs method arguments access in C++ I have a class that has some members, like x , y , width and height . In its constructor, I wouldn't do this: A::A(int x, int y, int width, int height) { x = x; y = y; width = width; height = height; } This doesn't really make sense and when compiled with g++ x , y , width , and height become weird values (e.g. -1405737648 ). What is the optimal way of solving these naming conflicts? You can use initialization lists just fine with the same names: A::A(int x, int y, int width, int height) : x(x), y(y), width(width), height(height) {

What is the preferred way (better style) to name a namespace in Ruby? Singular or Plural?

只愿长相守 提交于 2019-12-04 08:16:43
问题 What are for you the pros and cons of using: FooLib::Plugins FooLib::Plugins::Bar vs. FooLib::Plugin FooLib::Plugin::Bar naming conventions? And what would you use or what are you using? What is more commonly used in the comunity? 回答1: Use: module FooLib end module FooLib::Plugins end class FooLib::Plugins::Plugin; end #the base for plugins class FooLib::Plugins::Bar < FooLib::Plugins::Plugin; end class FooLib::Plugins::Bar2 < FooLib::Plugins::Plugin; end or in a different words: module

Is naming variables after their type a bad practice?

妖精的绣舞 提交于 2019-12-04 08:08:47
问题 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