naming-conventions

Should I change the naming convention for my unit tests?

血红的双手。 提交于 2019-12-04 01:18:28
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 end up with a list of tests something like: When_Reading_Valid_Employee (fixture) Employee_Object_Is

Better Python list Naming Other than “list”

江枫思渺然 提交于 2019-12-04 00:42: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? 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 names , and then I can write: for name in names: which I think looks pretty nice. But generally for your own

Entity Framework (Database-First) multiple relations to same table naming conventions control

≯℡__Kan透↙ 提交于 2019-12-04 00:00:39
Let's suppose that we have this situation: Tables in database: Country (id, country_name), Person (id, login), CountryManager (id_country, id_person), CountryStakeholder (id_country, id_person) If we had to create the model from the database, using Entity Framework Database-First, in VS we'd have a class like this: class Country { int id; string country_name; virtual ICollection<Person> Person1; // Navigation Properties virtual ICollection<Person> Person2; // ---------||---------- } I've simplified the code a lot, but hopefully you got the point. Seems that when Entity Framework deals with

Underscore after a variable name in Python

泪湿孤枕 提交于 2019-12-03 22:54:51
I am deciphering someone else's code and I see the following: def get_set_string(set_): if PY3: return str(set_) else: return str(set_) Does the underscore AFTER the variable mean anything or is this just a part of the variable's name and means nothing? No semantics are associated with a trailing underscore. According to PEP 8 , the style guide for Python, users are urged to use trailing underscores in order to not conflict with Python keywords and/or Python built-ins: single_trailing_underscore_ : used by convention to avoid conflicts with Python keyword, e.g. Tkinter.Toplevel(master, class_=

How do I name an interface when the base word starts with an I?

我怕爱的太早我们不能终老 提交于 2019-12-03 22:14:59
I want to create an interface for "Items". Typicaly I would name an interface by adding and "I" prefix to a base word. But in this case my base word already starts with an I. Here are a couple ideas I've had IItem : Two I's Iitem : Vary the case ItemInterface : Skip the I prefix and write out Interface What looks the best? Has anyone else run into this problem. If so what did you do? Although hard to read, IItem would be in line with some existing " II " interfaces: IItem in Windows Mobile 6.5 IImplicitResourceProvider IISAPIRuntime Simply IItem . There is no need for an exception. Interfaces

Auto-alias generated SOAP proxies

只愿长相守 提交于 2019-12-03 21:56:44
问题 I'm currently preparing to consume a SOAP web service in a .NET project (C#), however the naming conventions used for the service types and operations are pretty bad not consistent with the naming conventions typical to C# .NET projects . My question, essentially: is there a way to auto-alias the generated SOAP web service proxy types/methods in my client implementation? I'm hoping that there's some way to perform a transformation of the WSDL with a map of aliases, such that the generated (or

What is your preferred boolean pair: 1/0 Yes/No True/False?

99封情书 提交于 2019-12-03 21:19:20
When dealing with MySQL, I typically use the BOOLEAN type, which is equivalent to TINYINT(1), or 1/0 In most languages I work with, true/false is preferred When displaying forms, sometimes "Yes / No" makes more sense enum Bool { True, False, FileNotFound }; http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx In code: true/false. In the UI: Yes/No or OK/Cancel true and false makes a lot more sense to me, in code - partly through familiarity, I'm sure. I suspect I'd get used to yes and no pretty quickly. 1 and 0 really doesn't work for me though. Consider the expression age == 5 It's a test

Convention over configuration in ASP.NET MVC

☆樱花仙子☆ 提交于 2019-12-03 19:51:56
问题 I am relatively new to ASP.NET MVC, and am very impressed with the clarity of the platform so far. However, there is one aspect that I find uncomfortable. At first, I accepted the fact that when I say return View(); I am calling a helper method that returns an ActionResult, and makes some assumptions about which view to present, route values, etc. But lately I have been writing code that looks more like this: return View("Index", new { id = myID }) because it is immediately clear to me what's

What is correct Java naming convention for id?

拥有回忆 提交于 2019-12-03 19:48:10
问题 If I have user id variable, what is correct java naming convention for it? userId or userID 回答1: I think I read somewhere that the best guideline is to always capitalize only the first letter of an acronym (i.e., if you have a user TTL where TTL is some random acronym in your project, then it's best to write userTtl). This makes sense, since it solves some problems. For example, say you want a user id counter. Readability of userIDCounter is worse than userIdCounter. For a longer acronym, it

Name conventions for xibs

大城市里の小女人 提交于 2019-12-03 17:45:40
问题 I've been looking at the sample code and sometimes Apple names xib files ClassNameView and sometimes ClassNameViewController . The ClassName is always a UIViewController or UITableViewController , which had me wonder what convention to use when naming a xib. I would think View as it's not really the ViewController , but curious on what the convention is or at least what your naming conventions are for xibs. 回答1: I use ClassNameView since the xib represents the view, not the view controller. I