1
vote
0answers
96 views

How much segregation is too much in this design?

We are working on ASP.NET webforms application developed using WCSF (MVP pattern). In the application, there is a search screen that allows the user to enter some fields and display the results. We ...
0
votes
0answers
114 views

Storing an objects values into a new object, do they share the same values [migrated]

So I've been teaching myself C# the last few months and decided to work on a project to see what I can do with what I have learnt. So my question is this. Is this new Person selectedPerson a new ...
3
votes
2answers
334 views

Asterisks in Multi-line comments

Using Visual Studio 2012 with C#, when I write multi-line comments, VS automatically begins each line with an asterisk, like this: /* * * */ I was just curious if this was the case in ...
3
votes
1answer
83 views

Development console commands registration

I have a DevelopmentConsole class. I am making functionality to register console commands for the subsystems. I don't want the console to know about them but also I don't want them to contain a debug ...
2
votes
6answers
810 views

Stacking keywords on top of each other - poor style?

I have always wondered about this, especially in C/Java style languages. For example, consider the first 3 lines of this C# code: lock (serviceLock) using (var client = new ServiceClient()) try { ...
1
vote
3answers
1k views

Best Practices To Create Error Codes Pattern For an Enterprise Project in C# [closed]

I'm working on an enterprise project which will be deployed in many SMBs and Enterprises. The support for this project would be struggling and so I want to create a coding pattern for errors (Like ...
4
votes
3answers
610 views

Exceptions vs ErrorCodes when working with devices

Out team is at the cusp of a new project. One of the components at the boundary of the system is the component which interacts with a printer through an external COM component (referenced as a usual ...
6
votes
5answers
417 views

Why would a developer create a public class that has all static properties?

A previous developer has a couple public classes that do not inherit from any other classes but are filled with static properties. Is this another way of creating a struct or enum? Is this an older or ...
3
votes
3answers
119 views

Is it bad practice to have FooObject and FooObjectSummary?

I have a service where users can upload/download/replace/delete files. These files have about a dozen attributes that are saved to a SQL Database. Periodicaly throughout their session they will have ...
57
votes
11answers
6k views

Is it a bad practice to modify code strictly for testing purposes

I have a debate with a programmer colleague about whether it is a good or bad practice to modify a working piece of code only to make it testable (via unit tests for example). My opinion is that it ...
-1
votes
1answer
3k views

Object reference not set to an instance of an object [closed]

I'm making a simple Contact Manager as a practice project based on a XML file everything is working just fine except for two problems Every time I click on the white blank space on ListBox, I get ...
5
votes
4answers
3k views

Is it a good practice to create a ClassCollection of another Class?

Lets says I have a Carclass: public class Car { public string Engine { get; set; } public string Seat { get; set; } public string Tires { get; set; } } Lets say we're making a system ...
7
votes
3answers
2k views

How to encapsulate 'global' variables in C#? /best practice

In C# what is the best practice for encapsulating variables I need to use in multiple methods? Is it OK to simply declare them at the top of my class above the two methods? Also if I am using app ...
15
votes
4answers
1k views

Is the “Gets or sets ..” necessary in XML documentation of properties?

I am looking for a recommendation of a best practice for XML comments in C#. When you create a property, it seems like that the expected XML documentation has the following form: /// <summary> ...
0
votes
1answer
331 views

Is C# namespace should be Project-Name?

I am working with multiple websites (freelancer) and a good amount of them I write using C# MVC4. I created a very good boilerplace project that I plan to use on every next starting mvc4 application ...
1
vote
3answers
387 views

C# dynamics and Expando object [closed]

Under which application development scenarios C# dynamics and ExpandoObject can be used or when to consider using c# dynamics and ExpandoObject
4
votes
3answers
343 views

Renaming long named method in C# [closed]

I'm working on a project where exist one method with title string ValidateNewPasswordExpireCurrentPasswordAndCreateNewPassword(...) I'm sure the method name must be changed. But can't found good ...
5
votes
3answers
1k views

Child to Parent linking - bad idea?

I have a situation where my parent knows about it's child (duh) but I want the child to be able to reference the parent. The reason for this is that I want the child to have the ability to designate ...
13
votes
2answers
955 views

What is the best approach for inline code comments?

We are doing some refactoring to a 20 years old legacy codebase, and I'm having a discussion with my colleague about the comments format in the code (plsql, java). There is no a default format for ...
11
votes
13answers
2k views

Dealing with curly brace soup

I've programmed in both C# and VB.NET for years, but primarily in VB. I'm making a career shift toward C# and, overall, I like C# better. One issue I'm having, though, is curly brace soup. In VB, ...
5
votes
3answers
1k views

Exception Handling Frequency/Log Detail

I am working on a fairly complex .NET application that interacts with another application. Many single-line statements are possible culprits for throwing an Exception and there is often nothing I can ...
28
votes
15answers
2k views

Is it wise to be going back and forth between two programming languages? [closed]

I have been writing quite a lot of PHP for nearly two years. Now I am doing .NET (mainly c#) development. However, sometimes I go back and do some php. My main question is, is it wise for me to ...
7
votes
5answers
449 views

For what reasons should I keep “using” section clean in C#?

Once when I was refactoring my code, I went up the IDE to the using section of my C# class, and cleaned unused namespaces and duplicate namespaces, and sorted them all. My pair (pair programming) ...
6
votes
2answers
282 views

Is there a certain number of lines of code to be followed /maintain?

I am developing a software system (Patient Administration System) and I have noticed it already had 451 lines of code(in one namespace). Is this bad? Or does the number of lines of code not matter ...
27
votes
8answers
7k views

Private variable vs property?

When setting a value to a variable inside of a class most of the time we are presented with two options: private string myValue; public string MyValue { get { return myValue; } set { myValue = ...
16
votes
3answers
9k views

Which is a better practice - helper methods as instance or static?

This question is subjective but I was just curious how most programmers approach this. The sample below is in pseudo-C# but this should apply to Java, C++, and other OOP languages as well. Anyway, ...
15
votes
5answers
3k views

When and why you should use void (instead of i.e. bool/int)

I occasionally run into methods where a developer chose to return something which isn't critical to the function. I mean, when looking at the code, it apparently works just as nice as a void and after ...
3
votes
1answer
147 views

Should I forward the a call to .Equals onto .Equals<T>?

So, I've got you bog standard c# object, overriding Equalsand implementing IEquatable public override int GetHashCode() { return _name.GetHashCode(); } public override bool ...
19
votes
12answers
2k views

How to teach Exception Handling for New Programmers?

How do you go about teaching Exception Handling to Programmers. All other things are taught easily - Data Structures, ASP.NET, WinForms, WPF, WCF - you name it, everything can be taught easily. With ...
6
votes
11answers
884 views

C#/.Net/Programming talk [closed]

Lately we have decided in our company to have a monthly 30-60 minutes talk on a subject that relates to C#/.Net programming or anything else that will make us better in our work. We are currently ...