naming-conventions

Why is “lower-case with dashes” the standard for HTML classes? [duplicate]

人盡茶涼 提交于 2019-12-05 18:23:01
This question already has answers here : Closed 7 years ago . Possible Duplicate: Why are dashes preferred for CSS selectors / HTML attributes? Personally I use "lower-case with dashes" to format my HTML classes, which seems to be the standard these days. Using something like camel case seems more reserved for JavaScript in my eyes, but I realise that's just my opinion. I'm trying to improve front-end code consistency at my workplace and part of that will be coding guidelines. Rather than just saying "we should do it this way" I'm keen to hear some valid reasons behind this common trend. So

Better Python list Naming Other than “list”

a 夏天 提交于 2019-12-05 17:30:31
问题 Is it better not to name list variables "list"? Since it's conflicted with the python reserved keyword. Then, what's the better naming? "input_list" sounds kinda awkward. I know it can be problem-specific, but, say I have a quick sort function, then quick_sort(unsorted_list) is still kinda lengthy, since list passed to sorting function is clearly unsorted by context. Any idea? 回答1: I like to name it with the plural of whatever's in it. So, for example, if I have a list of names, I call it

Should Java member enum types be capitalized?

好久不见. 提交于 2019-12-05 17:14:04
问题 Anal question here: we have Java enums which are their own classes, and enums which are members of a class: public enum reportType { ... Every time I see this it jars me* because when I see it used in a declaration, it's a type, and types should be capitalized. But when I try to capitalize it, Eclipse warns me that I shouldn't capitalize field names. I figure Eclipse probably knows the official Java conventions better than I do, but it just doesn't seem right. Even flipped through the Java

Naming Conventions For Class Containing Acronym

倾然丶 夕夏残阳落幕 提交于 2019-12-05 15:33:56
If I am naming a new class in an OOP language, which is a better convention: XMLWriter Most common XMLwriter Easier to distinguish XmlWriter No longer an acronym XML_Writer Removes the point of camel case Pedantic yes, but I'm curious who uses what and why. david van brink Java conventions seem lately to favor treating well-known acronyms like words, so: "XmlWriter"... http://www.ibm.com/developerworks/library/ws-tip-namingconv.html Java Naming Convention with Acronyms <-dupe question? http://geosoft.no/development/javastyle.html But nobody seems to be very consistent. Take JavaScript's

Should I change the naming convention for my unit tests?

こ雲淡風輕ζ 提交于 2019-12-05 15:28:59
问题 I currently use a simple convention for my unit tests. If I have a class named "EmployeeReader", I create a test class named "EmployeeReader.Tests. I then create all the tests for the class in the test class with names such as: Reading_Valid_Employee_Data_Correctly_Generates_Employee_Object Reading_Missing_Employee_Data_Throws_Invalid_Employee_ID_Exception and so on. I have recently been reading about a different type of naming convention used in BDD. I like the readability of this naming, to

Is it bad style to reassign long variables as a local abbreviation?

折月煮酒 提交于 2019-12-05 13:18:57
I prefer to use long identifiers to keep my code semantically clear, but in the case of repeated references to the same identifier, I'd like for it to "get out of the way" in the current scope. Take this example in Python: def define_many_mappings_1(self): self.define_bidirectional_parameter_mapping("status", "current_status") self.define_bidirectional_parameter_mapping("id", "unique_id") self.define_bidirectional_parameter_mapping("location", "coordinates") #etc... Let's assume that I really want to stick with this long method name, and that these arguments are always going to be hard-coded.

Interface naming convention Golang

我怕爱的太早我们不能终老 提交于 2019-12-05 11:37:13
问题 I'll just post my code: /* * Role will ALWAYS reserve the session key "role". */ package goserver const ( ROLE_KEY string = "role" ) type Role string //if index is higher or equal than role, will pass type RolesHierarchy []Role func (r Role) String() string { return string(r) } func NewRole(session ServerSession) Role { return session.GetValue(ROLE_KEY).(Role) } func (this Role) IsRole(role Role, hierarchy RolesHierarchy) bool { if role == this { return true } if len(hierarchy) == 0 { return

Naming methods that are registered to events

天大地大妈咪最大 提交于 2019-12-05 11:17:51
Assume that I have a class that exposes the following event: public event EventHandler Closing How should methods that are registered to this event be named? Do you prefer to follow the convention that Visual Studio uses when it assigns names to the methods it generates (aka. +=, Tab, Tab)? For example: private void TheClass_Closing( object sender, EventArgs e ) Or do you use your own style to name these methods? I've tried different ways to name these methods (like TheClassClosing , HandleClosing , etc.). But I haven't found a good style to indicate that the intent of a method is to handle a

How to define a custom naming convention if EF 5

若如初见. 提交于 2019-12-05 10:45:09
Suppose that I have a database with 1 table named Products . So, I go through the Db First approach and create an EF model in VS 2012 with pluralize and singularize option. So, the model creates a Product entity for me, and default naming convention maps this entity to the dbo.Products table. Now I want to change this behavior. In fact I want to create a custom convention to map ProductModel entity to the dbo.Products table. Is this possible?! If so, how? Update: My goal to do it... As you know, whenever you update your model from database, if it causes a change in your model, the auto

Is the controller name derived from the class name?

戏子无情 提交于 2019-12-05 09:48:25
This is a newbie question... I am looking at the default asp.net mvc3 project and noticed that there is a controller called: public class AccountController : Controller I looked throughout the code and couldn't find a place that specified AccountController maps to /Account/ for the URL. I discovered that you can change the routing using routes.MapRoute(..) in the Global.asax , but I still don't know where they specified that AccountController maps to /Account/. If it is assumed from the class name, then does that mean all controller classes have to be named xxxxxController? Yes you are right,