^ Totally agreed renegade. And I also see as an architect very much that the newer programmers that I mentor don't *get* some stuff, because they don't know what goes on under the covers. And so they can't make good decisions devoid of this knowledge.
We process millions of rows of data a day. Someone slowed it down considerably, and I had to figure it out and fix it. The culprit? Enum.HasFlag. MS put it there, right? And it's a lot easier than bitwise comparisons- so the person used it. But this put everything in and make everything easy is removing the problem solving from new engineers- making them truly into 'code monkeys'. Yes, I know, in most situations, the difference in something like this wouldn't be noticeable. But see that I noted that this was in a loader that loaded
millions upon millions of records from financial entities daily? The developer just coming in wouldn't even know that- and indeed this one didn't. You have to know how something is done before you use it, so that you can make good decisions about when to use it.
Oh, and if you're interested- from my research on using that construct:
Except in the simplest of cases, the Enum.HasFlag carries a heavy performance penalty in comparison to writing out the code manually. Consider the following code:
[Flags]
public enum TestFlags
{
One = 1,
Two = 2,
Three = 4,
Four = 8,
Five = 16,
Six = 32,
Seven = 64,
Eight = 128,
Nine = 256,
Ten = 512
}
class Program
{
static void Main(string[] args)
{
TestFlags f = TestFlags.Five; /* or any other enum */
bool result = false;
Stopwatch s = Stopwatch.StartNew();
for (int i = 0; i < 10000000; i++)
{
result |= f.HasFlag(TestFlags.Three);
}
s.Stop();
Console.WriteLine(s.ElapsedMilliseconds); // *4793 ms*
s.Restart();
for (int i = 0; i < 10000000; i++)
{
result |= (f & TestFlags.Three) != 0;
}
s.Stop();
Console.WriteLine(s.ElapsedMilliseconds); // *27 ms*
Console.ReadLine();
}
}
Over 10 million iterations, the HasFlags extension method takes a whopping 4793 ms, compared to the 27 ms for the standard bitwise implementation.
My view is that the IDE should do most of the grunt work for you, and free you up to be creative. The language and IDE shouldn't get in the way - they should help you along. This is why I refuse to code any JavaScript in anything other than Aptana -- it does the work and lets me do the creation.
-Renegade
Try
Jetbrains Webstorm (or phpstorm). I have, and haven't gone back. A lot lighter that Aptana, and just as good.