As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Button: btnDoSomething
Button: DoSomethingButton
Property: FirstName
field: _list
The first I used to much. I want to see or learn new ways for my future codes. Use the best practices or general rules for naming them.
All your variables, fields, properties, classes.
Too many.
Worrying about that can be a drag on your productivity. Luckily enough, other people have already done the worrying for you, so you can follow these guidelines and concentrate on other issues.
http://msdn.microsoft.com/en-us/library/ms229002.aspx
.Net (and, I believe, MSVS) ship with a tool called "FxCop". Which, among other things, warns you if you violate "CamelCase" conventions:
http://www.binarycoder.net/fxcop/html/tutorial.html
Two links that might help:
MS Style Guidelines
A Brief History of Dueling Style Guidelines
Enjoy :)
PS:
Personally, I think Kernighan and Ritchie got it right in the first place ;-)
The first way of naming the button btnDoSomething is called Hungarian Notation and its obslete now. The second way is also having the Button as a suffix which is also equally unnecessary.
Why not just use ID="DoSomething"?
Here is a good read: http://10rem.net/articles/net-naming-conventions-and-programming-standards---best-practices
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've recently been tasked with pulling together 4 independent developers at my company into a cohesive team that generates similar (and good) code as a team.
We're implementing the use of iDesigns C# coding standard which will help our code look similar, and does give some implementation guidelines, but is there a general standard, rules of thumb (Top 10) out there for how code should be built, what every class should 'have' or 'do'?
I read this article by John Connelly about implementation practices, but am not having much luck in finding more references on the subject.
Is there a Implementation 'standard' out there for c# classes/projects? or is it such a broad subject that it can't be defined?
My favorites:
http://csharpguidelines.codeplex.com/releases/view/46280
Microsoft's Design Guidelines for Developing Class Libraries
StyleCop
Although it isn't a standard as such, I'd strongly recommend considering the use of StyleCop. It's a highly customizable Visual Studio plugin that allows you to easily enforce coding standards. Additionally it can be integrated into your cruise control server build, so that if any of those standards aren't adhered to, it breaks the build.
A very useful little tool, that at first I hated, but now I love.
The only C# standard C# has is the "Standard ECMA-334 C# Language Specification". Anything beyond that is up to the developer to do as they wish as they code their program.
Now there are some good rules of thumb to follow (like the two you referenced) but they are just rules of thumb. As long has the entire team is consistent with each other you can do whatever you want as a "standard".
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
As proposed by Brandon Walkin (for Xcode, but same thing), more visualization in the IDE can help productivity. In particular, I'd like to provide little icons to better convey the meaning of enum choices or classes (such as UI controls), roughly like this:
The built-in XML comment syntax clearly doesn't support this, but maybe someone has written an add-in to add support for, say, a <img> tag?
Man I love the Visual Studio Gallery for all the good things it contains.
Never seen anything like what you suggest there, but have seen plugin's for adding that kind of content to comments tho. This is one that I can find in there now (http://visualstudiogallery.msdn.microsoft.com/e216ec81-730b-4022-8305-25c39eb1f820), but I distinctly remember that there used to be one that allowed you to link to an image file (an export from say visio or it's ilk), and it would display it inline. I can't find it now tho :-(
You might want to look at this one, which is close, but not quite on the money http://visualstudiogallery.msdn.microsoft.com/c3eaa4fc-f2de-43ad-92ee-f0f257b79005. The source code is available here: http://csharpintellisense.codeplex.com/
And I'd actually like to thank you for drawing my attention back to that fabulous repository of goodness.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
College student about to major in CS. Just want to know if it really matter what language you learn first?
Seems to me CS and the nature of our work is about problem solving. Different language seems to differ in syntax, libraries you can use, etc. etc. But when it comes down to it, if you know how to solve a particular problem in one language, you could do it in other languages as well right? I mean surely some languages are better tools and can do a more elegant job, but at the end of the day the ideas are still the same right?
It doesn't matter what language you use. The algorithm underneath is the main thing that matters.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there a feature equivalent to C#'s regions for being able to group code into named blocks and collapse and expand them?
Alternatively, are there any workarounds or third party tools available to achieve the same result?
One possible workaround might be using F# Outlining VS Extension that provides //#region outlining functionality. I use it with VS2010 for couple of months without any problems and find it very convenient:
[-]//#region Region Name
--lines of F# code--
--lines of F# code--
--lines of F# code--
//#endregion
with one click collapses to
[+]Region Name
and back.
I found times ago (out of mine curiosity) the link the was searching on for asking this question.
If you look at Regions and navigation bar for F# in Visual Studio the guy seems implemented an experimental feature. Post of firsts of 2012, so it's pretty fresh stuff.
Should say that I didn't try it till now.
Good luck.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Trying to decide between Dapper, Massive and PetaPoco. I do like simplicity of Dapper, flexibility of Massive and POCO support in PetaPoco but am currently procrastinating about which one to choose for my next project.
I do realise that, to a large extent, it's the matter of personal taste, but believe it will be valuable to hear some opinions on the subject, especially from people who tried more than one of these, err, libraries (what is the right term: library, file, framework?)
Try to decide which of the features you mention -- simplicity, flexibility, POCO support -- will be most useful to you and your project(s) one year from now. Which is most likely to make your work easier?
Then you'll have your answer. And if you still can't choose, pick Dapper (just a random selection I made :-) As the Cheshire Cat says, if you don't really know where you want to go, it doesn't matter which road you choose.
PetaPoco's documentation seems more mature than others. It seems like it is the safest route.
i havent triend any of those. by default i always base my decision on number of lines of resulting client code and type safety. of course there are number of other metrics you should take into account but if your project is not constrained by any special (exotic) requirements those two are generally appliable.
btw. i am aware about controversy my response may lead to ;)