|
So... I guess, there's a comment like
(yes|no|maybe)*
|
|
|
|
|
Amusingly, that doesn't really tell us much - the compiler doesn't "allocate" memory, the stack is allocated when the program starts - this simply updates stack pointers.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Over-zealous on the documentation part but missed out some basic coding standards like below:
1) Magic Strings/Numbers in code.
2) It would be better to have the value of serial_getch() assigned in a variable and then used in switch instead of calling it directly as a function in the switch construct.
|
|
|
|
|
Probably he had a boss who complained about insufficient comments - like my boss often does when reviewing my code complains about missing annotations (just review annotations, the code was already commented properly). So I did more or less the same like our guy here - and my boss was happy. He didn't get that it was supposed to be ironic...
|
|
|
|
|
No horror here if it was posted to someone who's not into programming. E.g. "==" operator is not obvious and may provoke questions what does it mean. Also, telling about "allocating" memory is more understandable that introducing to how stack and pointers work.
Greetings - Jacek
|
|
|
|
|
|
And the one at the bottom of the page about exiting is a spelling mistake.
|
|
|
|
|
how ... you done that? Can it be reproduced and how I am curious
dev
|
|
|
|
|
|
According to the original post, you need to go to lunch while VS is frozen.
Greetings - Jacek
|
|
|
|
|
I think VS was busy
It's an OO world.
public class Sander : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
|
|
|
|
|
Now we know that VS has it's own way to "take care of business". I heard that it never happens if you have both VS and Eclipse installed.
Greetings - Jacek
|
|
|
|
|
Good code or bad code? Runs during a form constructor (testUser is a class bool).
public class a : Form
{
bool testUser;
a()
{
testUser = Array.IndexOf(new string[] { "mrock", "kasante" }, Environment.UserName.ToLower()) != -1;
}
}
I think my SQL experience influenced me slightly on this one.
|
|
|
|
|
Looks OK for a test code. And it's easy to extend. It would be bad if it was in a released code.
Greetings - Jacek
|
|
|
|
|
It's not in test code - it just sets a bool to determine whether features still being tested are available or not.
|
|
|
|
|
SortaCore wrote: It's not in test code (...) features still being tested
With a "test code" I (imprecisely) meant a "code being tested" -- which is the case.
Greetings - Jacek
|
|
|
|
|
No, it's used in release code, not as part of testing code - it specifies whether to allow the user to use beta functionality, basically.
Sorry if I wasn't clear. 
|
|
|
|
|
As stated, it's OK.
You could use a case-insensitive HashSet -- I would make it static in case the set of testers becomes large. And perhaps use the # if DEBUG directive.
If you find yourself copying this code to many forms, you could put it in a library method.
|
|
|
|
|
SortaCore wrote: testUser = Array.IndexOf(new string[] { "mrock", "kasante" }, Environment.UserName.ToLower()) != -1;
If you want to get a little tighter about it:
testUser = Array.Exists(new [] { "a", "b" }, t => t=="a");
First of all, you don't need string[] because the compiler can infer the array type.
Second, using "Exists" makes it clearer to the reader what you're doing, especially since you're not interested in the index, you just want to know of the value exists.
Lastly, the use of the predicate t => t == 'a' means you could do some fancier things if you wanted later on -- it's a more general purpose solution. (Where 'a' would actually be in your case Environment.UserName.ToLower()
Marc
|
|
|
|
|
We all understand what a "class" is and what an "instance" is. These terms have nice rigorous definitions. We are having a debate in school with one of the professors. Of course we have to follow there definition in that class but we are wondering what the real answer is. It seems like there are 3 possible answers.
1. An Object and Class mean the same thing.
2. An Object and Instance mean the same thing.
3. An Object is both a Class and Instance. Object is more of a higher order term that includes both.
After doing some web research it seems that over time the name has changed. Just referring to common usage. It started out in the 80's as the first choice. In the 90's things got confusing so they added the word class so they could deal with hierarchies of classes. After the turn of the century is looks like it moved mostly to the 2nd definition. Still it kind of still oscillates between 2 and 3. Some of us think we should not even use the word object because of the confusion and only use class and instance.
We are wondering what the rest of the world thinks now.
So many years of programming I have forgotten more languages than I know.
modified 14-Nov-13 14:53pm.
|
|
|
|
|
Don't think belong here, see the forum header description.
|
|
|
|
|
Where should it go? I could not find anything closer. I considered Design and Architecture but that seems to be more technical questions where this one is more general and philosophical. Looking at the other posts this group seemed more serious than Lounge.
It is kind of Weird and Wonderful how names change.
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
I've always chosen the definition "an object is the instantiation of a class" or "an object is an instance of a class"...
Therefore a class is the mere definition, prototypes...
The instantiation is a relationship between the object and the class, it's an action that represents saving memory space and create a new object of that class there.
And the object is that already instantiated class in memory.
At least this is how we manage our programs in the company
|
|
|
|
|
The traditional answer is, "it depends what you're talking about"!
- In .NET, there is a type called System.Object[^]; I believe Java has a similar type. When referring to that type, you are referring to a class. [#1]
- When you refer to "an object", you are usually referring to an instance of a class. [#2]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well, I would say your first bullet point is not equivalent to the OP's #1 (i.e. a class in general). Instead in this context Object is a specific type, which would be an additional 4th definition.
Regarding you second bullet point I agree. Before .NET I always considered an object to be an instance.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|