|
I'm sure you can just go pick one up; there's no security around.
|
|
|
|
|
PIEBALDconsult wrote: Total_Total
What's the second "total" for? Did the programmer have total recall?
|
|
|
|
|
Normal people might call it a "Grand total".
|
|
|
|
|
Nope. It's a symbol for Total/scoreTotal. He's calculating GPA or something.
"Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[ ^]
|
|
|
|
|
There are plenty of dumb things done in SQL. Could be the coder never heard of ISNULL. Could be he came from a programming background. Could be he doesn't realize ISNULL is more efficient than a case statement. Could be a misapplication of "don't execute a function in a where clause" rule. Could be he forgot about ISNULL. Could be he's in the "Let's obsfucate this code as much as possible" club.
At least it isn't SUM(CASE WHEN cTT.Total IS NOT NULL THEN cTT.Total ELSE 0 END) as 'Total_Total'
|
|
|
|
|
KP Lee wrote: At least it isn't ...
I think that's in a few other places.
This is an improvement over some earlier code by the same guy that is something like:
SELECT
(SELECT COUNT(*) FROM T WHERE ... ) A ,
(SELECT COUNT(*) FROM T WHERE ... ) B ,
(SELECT COUNT(*) FROM T WHERE ... ) C ,
...
|
|
|
|
|
Maybe he wants the code to be ANSI compatible.
In which case I would use COALESCE.
People say nothing is impossible, but I do nothing every day.
|
|
|
|
|
A few years ago, I was working on some very legacy code that required a temporary array in a function. The array size would never, ever change and could be hard coded.
The legacy code:
char* pData = new char[4];
delete[] pData;
When I mentioned this recently to a colleague, he said that a smart pointer should have been used. Today that would be:
std::unique_ptr<char> pData = new char[4];
Last week, I ran across a web site discussing optimizations that a similar concept, though with more items. Applied to the legacy code, this this "expert's" solution was:
std::vector<char> data(4);
Why not just my solution:
char data[4];
Have people gotten so accustomed to complexity that they think of only complex solutions?
(I have other examples, the second funniest was when someone suggested using a boost function instead of three lines of elementary C code.)
|
|
|
|
|
Was it possibly an aversion to placing items on the stack versus the heap? I can't imagine that four bytes (or perhaps even 8) would be enough to warrant the overhead of using the heap.
Perhaps, they just like to build in complexity as a job protection kind of thing. The times are rough, now a days.
|
|
|
|
|
We make it complex because mere mortals should never be able to understand us! Heh, heh, heh.....
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
People have become so used to using frameworks, the primitives that the framework is built on, no longer has meaning to them. It is both a shame but also a measure of the quality of the some of the frameworks being used.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
The days programmers could understand and master their programming languages are just over.
|
|
|
|
|
YvesDaoust wrote: The days programmers could understand and master their programming languages are just over.
Nonsense. A thorough understanding of the tools is, in fact, something that separates the top devs from the wannabes.
It does take a few years to achieve this mastery. The impatient recent grad or mediocre developer may delude themself that understanding cannot be achieved, but this is just an excuse.
That said, some tools do make it harder than others.
|
|
|
|
|
You have punched one of my hottest hot buttons: the tendency among far too many engineers to eschew the simple path.
My theory of the thing goes as follows: There are three stages in a software engineer's development / three types of software engineers / three phases to a life in software engineering:
1. The beginner: This engineer has little knowledge and less experience. That combination inclines him toward simplicity, for he hasn't the tools to get deep into the thickets, nor would he be confident of coming out alive. His programs tend to be easy to read, if sometimes a bit "naive."
2. The intermediate engineer: This engineer has begun to "feel his oats." He's learned quite a lot about various programming languages and fundamental algorithms, and he wants to show it off! So he embeds as much of what he "knows" in every program he writes as he possibly can. (Cf: "A Real Programmer knows every nuance of every instruction and uses them all in every Real Program.") His programs are next to illegible. After the passage of a few months, he won't want to admit to authoring them, much less maintain or debug them.
3. The senior engineer: This engineer is a grizzled, battle-scarred veteran. He's been around the block more times than you can count without taking off your booties. And while he can be a bit of a bore about those scars and how he earned them, his programs are a pleasure to read and maintain, because he's learned the virtues of simplicity. He never over-complicates a solution, because he's well aware that should it come apart under stress in a year's time, the most likely stuckee will be himself -- and remembering the rationale for excess complexity, and how to unsnarl it, is just too much like real work.
When I interview a fresh young candidate, I routinely describe the three types of engineers to him, and I ask: "Which sort of engineer do you aspire to be?" There are only two acceptable answers:
- A senior engineer, wise in the ways of the bits and a staunch foe of excess complexity;
- Hey, man, this engineering crap is just a stop along the way to the stars; I want to be the CEO of this place!
Food for thought.
(This message is programming you in ways you cannot detect. Be afraid.)
|
|
|
|
|
Some people never make it past The intemediate engineer. Their code is always almost impossible to decipher.
|
|
|
|
|
Well, if their employers are lucky, perhaps they go into the finance department.
(This message is programming you in ways you cannot detect. Be afraid.)
|
|
|
|
|
Hilarious. I am a programmer and my wife is in (another company) in the finance department. I get to hear the horror of that every day.
|
|
|
|
|
Or HR
If your neighbours don't listen to The Ramones, turn it up real loud so they can.
|
|
|
|
|
That is so true. The intermediate in any craft is out to proove himself and so shows off everything he knows whether it was the best solution for the problem or not. Were as the master shows simplicity and economy, doing more with less.
I found this[^] article on the same topic interesting.
|
|
|
|
|
You forgot...
n. The retread: An experienced developer (in Java for instance) may come to C++ with habits that aren't good C++. Need a thingy object? "myThingy = new Thingy(1,2);" That's how you do it in Java. In C++ you have more choices. In fact, the revised example (using STL) looks very much like a Java programmer doing C++ to me.
|
|
|
|
|
A good point. I had a subordinate like that: a highly experienced FORTRAN 66 programmer who had done a few years in management and had only just come back to the tech side. Thought all variables should be global. Couldn't see the point of classes and objects. Linked lists and dynamically allocated memory were incomprehensible to him. He was slotted into our C++ environment and just about fell apart. It took quite a bit of work to save him from the Grim Reaper.
(This message is programming you in ways you cannot detect. Be afraid.)
|
|
|
|
|
The beginner Says: I've got to try this and see if I can do it.
2. The intermediate engineer Says: I can do all these complex tech things that makes others look stupid and makes me look so superior.
3. The senior engineer Says: K.I.S.S. -> Keep It Simple Stupid.
4. Wisdom says, if an expert can't understand it, it's illegal.
That's my take on it.
|
|
|
|
|
An excellent condensation.
Apropos of which, the antidote I've found most effective against "excess cleverness" is a year or so programming exclusively in assembly language. Just about any engineer who has an assembler-only task will quickly realize that only simple assembler programs are debuggable or maintainable...no matter how determined to show off he is!
(This message is programming you in ways you cannot detect. Be afraid.)
|
|
|
|
|
Don't really agree with "showing it off".
When you learn a couple of patterns to solve a particular problem, you have the tendency to apply it on other problems and work around the rough edges, even though it makes it unnecessarily complex.
It's because you either don't 'see' the simpler solution (never change a winning team-code), or because you are used to solve more difficult problems and have a blind spot to see the obvious (university-code).
I can't speak for every programmer off course because some people are asshats, but it's not because something looks like the instruction manual of a galaxy-class warp drive written in Greek, that it's intentionally made incomprehensible.
.
|
|
|
|
|
Yes Joe, I agree with you.
Your solucion is the best one.
I never programmed it otherwise.
Only when the size goes over some multiple of 1000 bytes
I decide to allocate heap memory.
And yes: some programmers don´t even know why.
_______________________________________
|
|
|
|