I have a method that receives two range endpoints - start of range and end of range and an integer.
It checks to see if the integer falls between the two end points and returns either the integer or the corresponding end point if the integer falls outside the boundary.
Example 1:
RangeStart = 0; RangeEnd = 10; Value = 5; Returns 5
...
I came across a few articles like this one, which suggest that some words should never be used as part of a class name. When a class has one of those words in the name, it means the code should be refactored or redesigned.
Example:
Manager
Reason: Since almost all classes "manage" something and the meaning of "Manager" is very broad, ...
I'm working on a library that extensively used constructs like
typedef struct foo_bar_s {
...
} foo_bar_t;
It's a bad idea to use the _t suffix, because it's a POSIX reserved namespace. The _s suffix for structs is also pretty useless. So I thought I can change it all to
typedef struct foo_bar {
...
} foo_bar;
or if the str...
This question is a little silly, but sometimes it's tough to figure out how to name things correctly. The conversion will parse a config file into XML and vice versa. I want to call the program MyCompany.Config2Xml, but the program also needs to be able to "Xml2Config".
...
So the directory layout would look like:
Visual Studio 2008\
Projects\
MyCompany.MySolution\
Models\
Models.Tests\
Services\
Services.Tests\
UI\
etc..
rather than
Visual Studio 2008\
Projects\
MyCompany.MySolution\
MyCompany.MySolution.Models\
MyCompany.MySolution.Models.Tes...
From time to time I write a function that just creates something if it's not there yet and otherwise does nothing.
Names like CreateFooIfNecessary() or EnsureThereIsAFoo() do work but they feel a bit clumsy.
One could also say GetFoo() but that name doesn't really imply that foo may be created first and it only works if the function r...
Possible Duplicate:
What is the origin of the term heap for the free store?
Why is the heap called the heap? I mean the bit of memory which we dynamically allocate bits of.
...
I'm working on a software product (time tracking tool) which will be available in 2 flavors: a free version and a commercial version. I was thinking of naming them as "Free version" and "Professional version". At some point I will also have a 3rd version called "Enterprise" - for companies rather then individuals.
Can you suggest any be...
The title is probably not very clear. I have the following example in mind:
an Authenticator object authenticates a user using credentials. It returns a AuthResult object. This AuthResult object says the authentication succeeded, or that it failed (and if so, why it failed, eg username not found).
How can I phrase this in a test? 'test...
I cant for the life of me remember what the word is. It's when you ???? several if/else/for/while/usings inside each other.
bool isTrue = true, isFalse = true, HasForgottenWord = true;
if( isTrue )
{
if( isFalse )
{
if( HasForgottenWord )
{
Console.WriteLine("Ask on StackOverflow....
I often struggle with deciding how to name a class. Not so much because the class's purpose is unclear, but because of names like xxx*Controller*, xxx*Manager*, xxx*Info*, xxx*Helper*, xxx*Util* etc that I see everywhere.
If I have a class that uploads some stuff over HTTP, I tend to name it HttpUploader or something on those lines. ...
I've got a class that is essentially mutable, but allows for some "persistent-like" operations. For example, I can mutate the object like this (in Python):
# create an object with y equal to 3 and z equal to "foobar"
x = MyDataStructure(y = 3, z = "foobar")
x.y = 4
However, in lieu of doing things this way, there are a couple of met...
I have always thought it was "best practice" to be explicit in naming my collection variables. So, if I had a collection of Car objects, I would typically name a Car[] carArray and a List<Car> carList.
And then 99% of the time, I end up just doing something like...
foreach (Car car in carArray)
{
...
}
...and I'm thinking, I coul...
We have a SQL server with many databases in it. We have customers with multiple versions of a similar app and multiple apps for a single customer. Almost all databases are tied to specific websites.
How do you stay organized with your database names? Surely there is no single answer, but do you have a database naming strategy that is w...
When come to create an interface, do u create it based on behavior, follow the -able standard, e.g.
interface Comparable
interface Enumerable
interface Listable
interface Talkable
interface Thinkable
Or based on object, e.g.
interface Comparator
interface Enumerator
interface List
interface Human
And why?
UPDATE
This question is ...
What is the purpose of naming your constraints (unique, primary key, foreign key)?
Say I have a table which is using natural keys as a primary key:
CREATE TABLE Order
(
LoginName VARCHAR(50) NOT NULL,
ProductName VARCHAR(50) NOT NULL,
NumberOrdered INT NOT NULL,
OrderDateTime DATETIME ...
I have an issue when the T4 linq templates generate the classes for my MySql db using subsonic 3.
It looks like one of our table names "operator" is causing problems in the Context.cs generated class. In the following line of code in Context.cs Visual Studio sees <operator> as a c# operator and generates a compilation error of "Type exp...
I'm designing a programming language, so I've been putting a lot of thought into the way base types are named.
"Dictionary" seems like a bad name for what dictionaries do. They aren't organized lists of words with their definitions; they don't deal with words, they don't with definitions, and they aren't lists. The only vague associat...
Hi All,
Thanks for reading.
I know what AM/PM stand for (ante-meridiem and post-meridiem), but what are they called?
For example, if I am building a date/time from some fields, such as date, hour, minute, am/pm, and want the user to be able to select the time from some select menus like 1-12, 00-60, and am/pm, I would name the selects...
I'm guessing many of you have thought about writing your own programming language...I know I have. But once you've hurdled the complexities of implementing it, then you have the much weightier task of actually naming your creation.
This question was inspired by Fog Creek's decision to call their compiler Wasabi instead of "Bone Crusher...