naming-conventions

How important are naming conventions for getters in Java?

落花浮王杯 提交于 2019-12-03 17:15:28
问题 I’m a huge believer in consistency, and hence conventions. However, I’m currently developing a framework in Java where these conventions (specifically the get / set prefix convention) seem to get in the way of readability. For example, some classes will have id and name properties and using o.getId() instead of o.id() seems utterly pointless for a number of reasons: The classes are immutable so there will (generally) be no corresponding setter, there is no chance of confusion, the get in this

What does it mean when `Ex` is added to a function/method name?

南笙酒味 提交于 2019-12-03 17:11:20
问题 I don't work with the Windows API much, but I've seen it used there as well as occasionally in a codebase here at work. 回答1: Yup, they wanted to improve (Extend) the API and keep a similar name so it was likely that the programmer would move to the new version. Notable is GetVersionEx() to get the Windows version, pretty painful for a while with a nasty chicken-and-egg problem. The record keeper is the National Language Support team who have several ExEx versions, like EnumCalendarInfoExEx.

Are there established alternatives to ISomething / ISomethingable for interfaces?

爷,独闯天下 提交于 2019-12-03 17:09:30
问题 The .NET standard of prefixing an interface name with an I seems to be becoming widespread and isn't just limited to .NET any more. I have come across a lot of Java code that uses this convention (so it wouldn't surprise me if Java used it before C# did). Also Flex uses it, and so on. The placing of an I at the start of the name smacks of Hungarian notation though and so I'm uncomfortable with using it. So the question is, is there an alternative way of denoting that Something is an interface

Visibility Autobinding with naming convention

眉间皱痕 提交于 2019-12-03 16:56:34
问题 I really like Caliburn and the naming convention binding and was surprised that the Visibility is not bound in the same way the "CanNAME" Convention is used to guard an Action. As far as I know is the BooleanToVisibilityConverter only used when Binding is explicitly used in Caliburn and not automatically like the guard method. So I was thinking to modify the source to bind automatically to "bool? ControlNameIsVisible()" (null equals collapse) or similar. I was wondering if that is the right

Is there a difference between int *x and int* x in C++? [duplicate]

坚强是说给别人听的谎言 提交于 2019-12-03 16:53:51
问题 This question already has an answer here : Difference between char* var; and char *var;? [duplicate] (1 answer) Closed 6 years ago . I'm getting back into my C++ studies, and really trying to understand the basics. Pointers have always given me trouble, and I want to make sure I really get it before I carry on and get confused down the road. Sadly, I've been stymied at the very outset by an inconsistency in the tutorials I'm reading. Some do pointer declarations this way: int *x and some do

C# Project folder naming conventions

做~自己de王妃 提交于 2019-12-03 16:42:34
问题 I have a project called Data which is a data layer. In this project, all files are just lying in the top folder. I have enumerations, POCOs, repositories, partial classes and so on. If i want to move those files into subfolders, what would be the preffered folder name for each folder? Is there any convention? The "Repositories" folder is pretty obvious, but where should i keep POCOs and enumerations? Thanks 回答1: I tend to use project folders as a way of separating out sub namespaces. So in

Python abstract classes - how to discourage instantiation?

对着背影说爱祢 提交于 2019-12-03 16:38:24
问题 I come from a C# background where the language has some built in "protect the developer" features. I understand that Python takes the "we're all adults here" approach and puts responsibility on the developer to code thoughtfully and carefully. That said, Python suggests conventions like a leading underscore for private instance variables. My question is, is there a particular convention for marking a class as abstract other than just specifying it in the docstrings? I haven't seen anything in

What is the naming convention for typeclasses in Scala?

本秂侑毒 提交于 2019-12-03 16:37:09
问题 In Java world, the naming conventions for interfaces are pretty much well established. For instance, when you say certain class implements the interface Comparable , you can say that it's objects are comparable. However the naming conventions for typeclasses are not so well established. For example, Int has a Numeric implicit available, so you can say " Int is a Numeric type". But then there is typeclass Ordering . I fail to see why this name was chosen. " Int is an Ordering type" doesn't

What is the preferred naming convention for Func<TResult> method parameters?

戏子无情 提交于 2019-12-03 16:23:26
问题 I admit that this question is subjective but I am interested in the view of the community. I have a cache class that takes a cache loader function of type Func<TResult> , which it uses to retrieve a value from the database and store it in cache. public static class Cache { public TResult Get<TResult>(string cacheKey, Func<TResult> cacheLoader) { // Implementation } } My question is: How should I name the function parameter? Should I name it like an object, e.g. cacheLoader ? Should I name it

How recommended is using custom double underscore variables in Python?

我们两清 提交于 2019-12-03 15:47:15
I was wondering, is it recommended/Pythonic to define and use custom double underscore variables/functions in a Python script? For example, __tablename__ as used in SQLAlchemy or __validateitem__() (a custom function that validates an item before applying __setitem__() to it). If it does define that something magic happens, or that that specific variable/function is used indeed in a special way (like the two above examples), I feel it is a good idea using them. I am interested in arguments on both best coding practices and potential risks in using this kind of naming. From PEP8: __double