Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
![](/static/devrant/img/pipeless-devrant-banner-white.png)
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@GinjaNinja tacking on an m or s onto a variable is a common Android convention, used to denote member and static variables. Even though this is a C# related preference, such a convention prevents accidental shadowing of your variables, which can often happen if you're not careful. Plus it's easier to identify where what a variable's scope is just by looking at it. My $.02 anyway...
-
@codeclod it's generally not done in most languages and is seen as bad practice. It harks back to Hungarian notation, just like adding cbo to a combobox or str to a string, it's just means that you variables are poorly named for there purpose. Adding a single m to the start to denote module level vars seems kinda antiquated to me, your class should be single purpose so module scope vars should also have relevant names !
Just my 2 cents -
@bluescreen I guess I'm jaded by the fact I can never tell what someone else means with their names and design half the time (due to a number of reasons), such that it seems easier to use a convention that can actually be automatically audited (such as with checkstyle), rather that rely on everyone on your project to not do stupid things. I guess this why we have devRant 😉
-
@codeclod it take team discipline. Once everyone agrees it's quite easy to police and having a style check process like stylecop or similar really helps. I personally think it makes your code that little bit more readable.
-
@bluescreen yep. I am definitely a proponent of your class design inherently describing only the intended purpose, nothing more, nothing less. That's a harder thing to coach, and while you do so, such conventions (which I've gotten used to) helps keep the poor design in check. I can understand the ugliness, and propensity to deem it redundant. Although, I'm more willing to entertain the label of the specific UI element rather than the raw data type in the name, simply because it ties me to the user interaction point, rather than the underlying data type (cbox or comboBox, as opposed to str for a String). I'm just inconsistent in my preference 😧
-
@codeclod design patterns like mvvm help as your model and view model describe the data and the controls simply bind to there iterators and command sources allowing you to separate ui and interaction logic
-
@bluescreen yep. We use a lot of JavaFX now, which does a good job of building in those abstractions.
-
I always use _variable. Apparently that's also the official coding style of the .NET Core team as well.
Related Rants
C# peeps... Which one?
private int number;
||
private int _number;
undefined
c#
formatting