419 reputation
212
bio website stackoverflow.com/users/…
location London
age 23
visits member for 2 years
seen 13 hours ago

++++++++[>+>++>+++>++++>+++++>++++++>+++++++>++++++++> +++++++++>++++++++++>+++++++++++>++++++++++++> +++++++++++++>++++++++++++++>+++++++++++++++> ++++++++++++++++<<<<<<<<<<<<<<<<-]>>>>>>>>>>> -.+>>---.+++>----.++++----.++++<<<<<<<<<<.>>>>>>>>> ----.++++>-.+--.++<---.+++<<<<<<<----.++++<<.>>>>> +.-<<<<-.+>>>>>>>>>---.+++<<<<<<<<<<.>>>>>>>>>> ---.+++-.+++.--<---.+++<<<<<<<<<.>>>>>>>>>+.-> --.++>----.++++ <-.+<<<<<<<<<<.>>>>>>>>+++.---<<<<<<<<+++.---.>>>>>>>>>> ---.+++>+.-<+++.---<---.+++> ----.++++<--.++<<<<<<<<<.>>>>>>>>>>>----.++++<<.> -.+>---.+++<<-.+<>.<<<<<<<<<<<<<.

THINGS TO DO BEFORE BROWSING HOTTEST QUESTIONS:


1d
comment Are all magic numbers created the same?
@whatsisname It's an example. It's a nice equation with two well known constants. In a world where pi was exactly 3 I would prefer pi. I will agree there is a limit. If I'm manipulating bytes internally I'm not going to constant out numbers like 8. However, if was was converting file sizes I would. It depends on how business logic-y stuff is. I think Doval makes I good point in regard to the OP's example, but this answer is still misguided.
1d
comment Are all magic numbers created the same?
No. A comment like the one in your "better" example is a massive red flag. It's code that doesn't even pass the readability test of the person writing it at the time. I'll give an example. e^i*pi = -1 is far more explicit (better) than 2.718^i*3.142 = -1. Variables matter and they're not just for common code. Code is written for reading first, compiling second. Also, specs change (a lot). While the 1024 probably shouldn't be in config the 3.5 sounds like it should be.
Dec
9
comment Using reflection vs creating a new class
Your friend is right. He is so completely right I doubt I can get to a real keyboard before someone else explains why.
Nov
20
awarded  Yearling
Oct
9
comment Choosing a Programming Language Systematically
@Robert Harvey Ahhh. Good point. I hadn't really counted a javascript, C#, SQL project as "multi-language" because it's minimal and all of it has purpose. I would say there's still a cetral point to what I said.
Oct
8
comment Choosing a Programming Language Systematically
Really? The era of multiple languages? I have no interest in flipping between C#, F# and C++/CLI on the same day. Is the assumption we strictly the areas of code we edit, or that we are all become proficient in multiple languages? This isn't the place to discuss this, but just a heads up that that's a contentious brush stroke you've got there.
Oct
8
comment Choosing a Programming Language Systematically
Ha, I love the reckless enthusiasm of the last paragraph. I would say it is the CEOs domain because of that pesky 6 months you mentioned, which is all you need to tell him/her imho.
Sep
26
answered In C#, can I do “this = …” outside of a constructor?
Sep
23
comment Is it okay to use exceptions as tools to “catch” errors early?
@MarkHurd It is language dependant, broadly speaking. For example what you do in Java is different to say C++. We are implicitly relying on the existence of finally blocks, garbage collection, that we don't need to worry about destructors or stack unwinding. The modern exception approach is not universal to languages.
Sep
23
comment Is it okay to use exceptions as tools to “catch” errors early?
@user2236631 As this code looks like java (which I will call a language with "modern" exception handling), that would be extremely bad practice.
Aug
26
comment C# - initialize variable inside method and use in whole class
+1 To clarify the difference between the two it is often useful to put this.player1 = p1; when you are using instance fields, properties and methods of the class to show you're not using local variables.
Aug
13
comment How do you guard against hidden overflows
In case you haven't changed it yet, your mean value calculator doesn't need to use large intermediate values. Here is an example. To stray from language-agnosticism, C#'s checked is related to this and 28 million is no sweat for its decimal type.
Aug
11
comment Property-coalescing operator for C#
Hello 2011, just called to say that c# is getting a safe navigation operator
Aug
8
comment Develop in trunk and then branch off, or in release branch and then merge back?
What you do it source control depends on your needs. It would provide useful context if we knew whether everyone is working towards the release or are there devs working on post release stuff? Do you have effective regression testing, how long is the build-deploy-vefify cycle? (eg if lots of devs are working on post release and there's a lot of inertia in the testing avoid option 1 with a passion)
Aug
8
awarded  Organizer
Aug
8
revised Is it bad practice to resolve null arguments to default static variables?
added language tag
Aug
8
comment Is it bad practice to resolve null arguments to default static variables?
@bigp Ahh interesting. Optional param but no overloading, weird. Are you allowed to assign GameBaseClass.INSTANCE.currentAtlas or does it have to be constants. I've added a language tag to lure any action-script aficionados.
Aug
8
suggested approved edit on Is it bad practice to resolve null arguments to default static variables?
Aug
7
comment Extending a struct. Using helper classes rather than composition
So... Rename DateTimeHelper to DateTimeFactory?
Aug
7
answered Is it bad practice to resolve null arguments to default static variables?