I really appreciate the possibility to define regions in your code, as it improves the readability insanely.
Anyways, I'd like to have everyone using the same convention in all classes (with the predefined order of all regions) like:
Private Fields
Constructors
Class Properties
Event Handlers
etc...
Do you have any proposition how ...
There is a pattern that I use from time to time, but I'm not quite sure what it is called. I was hoping that the SO community could help me out.
The pattern is pretty simple, and consists of two parts:
A factory method that creates objects based on the arguments passed in.
Objects created by the factory.
So far this is just a stand...
I frequently find myself creating classes which use this form (A):
abstract class Animal {
public void Walk() {
// TODO: do something before walking
// custom logic implemented by each subclass
WalkInternal();
// TODO: do something after walking
}
protected abstract void WalkInternal();
}
class Dog : Animal {
...
In my naming convention, I use _name for private member variables. I noticed that if I auto-generate a constructor with ReSharper, if the member is a keyword, it will generate an escaped keyword. For example:
class IntrinsicFunctionCall
{
private Parameter[] _params;
public IntrinsicFunctionCall(Parameter[] @params)
{
...
I got tired of writing the following code:
/* Commenting out irrelevant parts
public string MiddleName;
public void Save(){
SqlCommand = new SqlCommand();
// blah blah...boring INSERT statement with params etc go here. */
if(MiddleName==null){
myCmd.Parameters.Add("@MiddleName", DBNull.Value);
}
else{
...
I notice several well-known projects in java that were ported to C# .NET. Some examples:
Hibernate -> NHibernate
JUnit --> NUnit
Ant --> NAnt
Lucene --> Lucene.Net, NLucene
iText --> iTextSharp
log4j --> log4net
Quartz --> Quartz.NET
I was curious about the reverse situation: what are the notable .NET projects that have been ported ...
I never really know how to name VBA modules. Should I:
Use a prefix, like basName or modName.
Not use a prefix, like Module. (But avoid restricted words)
Something else
...
Consider a Web Service (e.g. SOAP-based) that has an operation which accepts a bulk of data from the client. From the server's point of view it is receiving data, but from the client's point of view it's sending data. How should that operation be named? The options are
ImportData
ExportData / SendData
Is there a de facto standard for...
Is there a way to export the re-sharper's code guidelines / naming-conventions to an XML file?
...
I have generally always used some sort of Hungarian Notation for my field names in my tables e.g.
#Table Users
u_id, u_name, u_email etc...
#Posts
p_id, p_u_id, p_title, p_content etc...
But I have recently been told that this isn't best practice. Is there a more standard way of doing this? I haven't really liked just using the field...
Hi.
I could use a little advice on naming my assemblies
(ie. When to turn a logical naming convention in my
namepaces into its own DLL).
I recently downloaded an example project with a ton of
class libraries in it that almost exactly mirrored the
namespaces.
To date, I have been building one massive class
library - MyProject.DLL ...
What does w mean in im2bw ?
...
Hi
This is not an actual Xcode error message, it is a warning that has been haunting me for
a long time. I have found no way of removing it and I think I maybe have overstepped some unwritten naming convention rule.
If I build a class, most often extending NSObject, whose only purpose is to do some task and report back when it has data...
Something I see ppl define the variable like this:
b2World *_world;
b2Body *_body;
CCSprite *_ball;
instead of
b2World *world;
b2Body *body;
CCSprite *ball;
I familiar with the second one, but not the first one. So, I checked the Wikipedia about naming convention:
Names beginning with double underscore
or an underscore and a...
I need to create database for SQL Server, what kind of naming convention I sohuld use?
1) Table names could be : customer, Customer, CUSTOMER
2) Field names could be : customer_id, CustomerId, CustomerID, CUSTOMER_ID, customerid, CUSTOMERID and so on...
Is there any official suggestion for naming conventions or what is msot common way...
When writing utility classes in Java, what are some good guidelines to follow?
Should packges be "util" or "utils"? Is it ClassUtil or ClassUtils? When is a class a "Helper" or a "Utility"? Utility or Utilities? Or do you use a mixture of them?
The standard Java library uses both Utils and Utilities:
javax.swing.Utilities
javax.print...
What should be the convension while naming components and why?
E.g
myJobButton
buttonMyJob
EDIT:
When typing i.e. on netbeans and using code completion with ctrl+space
if you choose the second naming convension then typing "button" results on a sorted list of all your buttons.
...
Hi,
I'm going to build an installer to deploy my application which is a Windows executable file(not a MSI file). I'm using NSIS. This application targets French people and "install" word is close to "installation" in French.
Is there a filename convention? What is the best choice for you?
It seems that "setup.exe" is the most popular n...
Working on an abstraction thing and am trying to figure out proper pattern for naming variables in a setter/getter + calculated case.
There is an attribute of the class that will be either calculated by the code in the class, or it can be specified to contain fixed value by the consumer of the class. Also the consumer might be intereste...
Hello,
On one side, in Vb.Net when you add an event handler to an object the created method is named: <NameOfTheObject>_<NameOfTheMethod>.
As I like to have consistent syntax I always follow this rule when creating event handlers by hand.
On the other side when I create private variables I prefix them with m_ as this is a common thing...