I have a class (Foo) which lazy loads a property named (Bar). What is your preferred way to protect against mistaken use (due to intellisense or inexperienced staff) of the uninitialized backing field?
I can think of 3 options:
class Foo {
// option 1 - Easy to use this.bar by mistake.
string bar;
string Bar {
...
I have a Tree.
class TreeNode {
public TreeNode(string name, string description) {
Name = name;
Description = description;
}
string Name { get; set; }
string Description { get; set; }
public List<TreeNode> Children = new List<TreeNode>();
}
I would like to populate a large one for unit testing purp...
SRP(PDF version; HTML version) states that
There should never be more than one reason for a class to change
When you take a look at Outlook, Calendar Event window, it has "Save and Close" button.
So when the functionalities of either or both Save or Close changes, that button should change. It obviously violates SRP.
This func...
What is the Framework Design Guideline for naming boolean properties? If there isn't one, then what's your recommendation?
Let's say I have a User class, and I need a property that specifies if the user is enabled or not. These are the options I can think of:
Enable
Enabled
IsEnabled
Disable
Disabled
IsDisabled
Also, if the BL says ...
I'm getting push back on a design from a colleague, and am wondering if there's consensus as to who is correct on application of SRP in this case.
I see SRP as relating mostly to the lower-level details of design, such as class responsibility. As you move up in levels of abstraction I believe SRP is still relevant but that the definiti...
hi Everybody.
I am a newbie and developed a sample application for BlackBerry with Multiple Screens, following a book.
I wanted to develop a application similar like Viigo http://viigo.com/
What are the controls i should use?
Does it require custom control development?
I have designed a login form, and i want to authenticate it thro...
Last night I came up to sometihng intersting while designing my new project that brought me to ask this qustion here.
My project is supposed to follow Table Gateway pattern using tradional ADO.Net datasets for data access. I don't want to write plain queries in my data-access classes. So I came up with an idea of writing a parser kinda...
I have the following set of controls.
Scenario 1:
If you select one of the first 3 radio buttons and click enter, focus will jump to the Passport Number text box. If the user selects "Other", the "Other, Please Specify" textbox is enabled and, for convenience, screen focus (the cursor is moved) to that textbox.
Scenario 2:
The "sp...
I worked on different projects in different countries and remarked that sometimes the code became internationalized, like
SetLargeurEtHauteur() (for SetWidthAndHeight, fr)
Dim _ListaDeObiecte as List(Of Object) (for _ObjectList, ro)
internal void SohranenieUserov() (for SaveUsers, ru)
et...
We're designing an Android app that has a lot of data ("customers", "products", "orders"...), and we don't want to query sqlite every time we need some record. We wanna avoid to query database as most as we can, so we decided to keep certain data allways in memory.
Our initial idea is to create 2 simple classes:
"MemoryRecord": a clas...
What are the best practices/guidelines for writing test suite for C++ projects?
...
Hi guys,
Look at here (Abstract Class Design): http://msdn.microsoft.com/en-us/library/ms229047.aspx
It says:
(1) Do not define public or protected internal (Protected Friend in Visual Basic) constructors in abstract types.
In C#, we are not able to instantiate an abstract class. So, does it still matter to define public constructors...
Sorry if the question is obvious, I am only starting to work with Rails.
I have a following code in several controller methods now:
respond_to do |format|
if @project.save
format.html { redirect_to(edit_project_url(@project), :notice => '#{user.name} added to #{role}.') }
format.js
else
format.html { rend...