|
Hmm,
I will never complain about Visual Basic again...

|
|
|
|
|
Good lord, I'm having flashbacks from my last job. We had nearly 500,000 lines of SQL in stored procedures. And I really don't see the need for the "usp" prefix. Is it really so common to confuse a user stored procedure with a system stored procedure?
At least it seems the developers that made this attempt to maintain some sort of style. At my current job, most stored procedures look like they were generated from a designer and no attempt was made to format the code.
I feel your pain.
|
|
|
|
|
Hmm - lots of comments giving the reason for a change as "as suggested by manager". Doesn't inspire confidence that the person making those changes understood why they were done.
|
|
|
|
|
Yes, I particularly like the addition:
IF (@Mh_Mfno = -2)
BEGIN
SET @Scrap_Qty = @Prod_Qty
END
which to me sounds like
"if I press the red button, dump all produce on the garbage heap"
P.S.: I wonder if one of the 'M's in Mh_Mfno stands for 'Manager' 
|
|
|
|
|
virang_21 wrote: BEGIN TRAN
Branch_One:
TRUNCATE TABLE MachHistTemp
I stopped reading the code after this.
A DDL statement within a transaction?
Φευ! Εδόμεθα υπό ρηννοσχήμων λύκων!
(Alas! We're devoured by lamb-guised wolves!)
|
|
|
|
|
Actually, truncate _can_ be rolled back on SQL server, so it is not as bad as it would be if it were Oracle code.
|
|
|
|
|
Ah, yes, you're quite right on that one.
Φευ! Εδόμεθα υπό ρηννοσχήμων λύκων!
(Alas! We're devoured by lamb-guised wolves!)
|
|
|
|
|
You can refactor it. Also, I don't know for Oracle or other DBs, but there's a debugger with breakpoints, local vars, step into and all such stuff available for MySQL.
OTOH, packing business logic into SQL (which I'm under the impression that it happens here) is always a bad idea - unless you really do pack your entire logic in SQL, and have stored procedures which are in fact the equivalent of services, and no or almost no logic in your client app.
And yes, I do agree it's horrible the way it is now. Whoever designed the database clearly has no notion of sane naming conventions.
|
|
|
|
|
virang_21 wrote: I am not saying stored proc are bad
I'm no DB expert, but stored procedures always seem to violate the "do one thing and do it well" principle. Seems to me, DBs should, I don't know, store data. Acting on that data seems to go beyond their purview.
About the only case I can think of where an SP might be appropriate is to synthesize read-only data from other stored data.
|
|
|
|
|
The size of the proc is scary enough, but here's the scariest thing in my opinion.
Added IF condition on 4/Nov/2009 as suggested by Manager.
Changed the Where Clause on 18/November/2009 as asked by Manager
Really? What do system analysts do in this company? 
|
|
|
|
|
Another project from our "star" developer who is apparently beyond contempt in every way.
I was given this website (an ASP.Net Webforms project written in VB10) to add some additional metrics. To my horror I found that even though written very recently (within the last 2-3 years) and then updated to use a new Linq-to-Entities data source, there was no regard for architecture, and all of the data access code was written directly in the code behind of the aspx pages.
That's not even the real horror. I was getting (seemingly) random errors while trying to run it/understand it, and found that through-out all of the loads of Linq statements that all of the nullable types (e.g. Integer?, Double?, DateTime?, etc.) were being treated as if they were not nullable at all!
Here is an example to help you understand (table/field names changed slightly to protect the guilty):
Dim partTransactionTypeThingsQuery As IQueryable(Of SomeTransactionRelatedItem) = _
From t In baseQuery
Join tji In dataContext.OtherTransactionItems _
On tji.SomeTransactionID Equals t.ID
Where (t.LastUpdatedDate >= startDate _
And t.LastUpdatedDate < endDate) _
And (tji.Type = "Part") _
And (tji.TotalDue <> 0)
Select tji
LastUpdatedDate is a Nullable(Of Date) and TotalDue is a Nullable(Of Double) and when it translates to SQL it will work just fine.. The problems come about when the context switches from Linq-To-Entities to Linq-To-Objects (I have to watch closely for a .ToArray() or .ToList() or anything else that executes the SQL and fetches results) and much of the aggregation is doing exactly that.
I don't even know how many of these problems there are... Anyways, thanks for letting me rant a bit. Any suggestions? Is suicide a viable alternative to fixing thousands of lines of VB Linq statements of this nature?
|
|
|
|
|
And to those who will start the VB vs. C# debate, it is not VB that it the problem.
The Problem exists between the chair and the keyboard. (AKA, PEBKAC)
Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions.
Dave Barry
Read more at BrainyQuote[ ^]
|
|
|
|
|
PEBKAC ! I had forgotten about that one, thanks for reminding me. Yes, I would say that is usually a problem with computers. Also, thanks for reading my rant it makes me feel like at least someone listened.
As for the C# vs. VB debates, I don't really mind. It really gets so funny at times (people will argue the silliest things based on ideas that aren't even true). There is no problem with VB.Net especially for those of us who code using 'Option Strict On' (I'm really biased towards static typing). I find VB preferable because of the way you can easily tell where each block begins and ends. Doing so with this is hard for me: {{{{{{{{{{}}}}}}}}}} 
|
|
|
|
|
I always have Option Strict On, and a lot of VB projects I download from different sites won't compile with it on, so I modify them to compile.
Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions.
Dave Barry
Read more at BrainyQuote[ ^]
|
|
|
|
|
You are wrong. VB is the problem. It was always sold as sooooo easy to learn and use and then remained the safe harbor for all the horror coders they had picked up. A kind of Jurassic Park for coders.
Give a user a program and he can work for a day. Show the user how to program and you have work for the rest of your life.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
CDP1802 wrote: Give a user a program and he can work for a day. Show the user how to program and you have work for the rest of your life. Love that one
'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood
'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail
|
|
|
|
|
But please don't get me wrong. I have met people who taught themselves and also were very capable of logical thinking. Once a mailman (who only had some experience on a C64) told me about the bugs in a Win32 program, where to look in the code and how to fix them. And then there is that great mass of users who think they know everything...
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
Yup, I've got some mixed experiences too: on the one hand self-taught guy who did great complicated stuff, like expert systems, AI, etc... and on the other hand supposedly 'educated' engineers who couldn't tell a variable from an instruction.
And users, ah users, ...
'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood
'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail
|
|
|
|
|
Quote: You are wrong. VB is the problem.
I'm afraid not. Go ahead and open your mouth and insert your shoe. In this case it is a combination of ignorance and arrogance that is the problem (something that you also seem to be displaying by this comment). Since you know so much about the culture of my workplace, why don't you expound upon that?
|
|
|
|
|
Sasha Laurel wrote: Go ahead and open your mouth and insert your shoe No, thank you. But I would like to test Newton's third law. How would you like it? Shall I take that shoe and let it collide with your rear side or shall I just keep writing?
What I did say was, that VB was always advertised as 'easy to learn' and 'ideal for beginners'. If I may translate that: If you are too lazy to learn or too dumb for anything else, then use VB. What I did not say was that all people who use VB are of that kind.
Anyway, what you call arrogance is what I call self defense. I do not think that I can stop an army of the lazy and the dumb from doing vtheir evil, and therefore I do not preach. What I do is to stay away from them and not allow them to drag me into their desasters. It's remarkable how often things turned ugly when I did not manage to avoid VB.
Indeed I just have to look into source control, my bosses' chamber of horrors, to find 10+ years of madness. It was of course the bosses' pointy-hairedness that got them into this in the first place. It took some years for them to realize that it might help if they hire developers that actually learned their job. It's amazing how many of those failures were written in VB, or perfectly good projects converted to VB and then mercilessly butchered. Or former VB 'developers' who had turned 'professional' and looked for new places to commit the same old sins. The only projects that showed a better quality were programmed in C++, which does not have the reputation to be 'easy to learn' or 'ideal for beginners'. What a coincidence.
Sasha Laurel wrote: Since you know so much about the culture of my workplace, why don't you expound
upon that? For your sake, I hope that this is the culture of your workspace. For my part, I prefer to be called ignorant and arrogant before voluntarily getting myself into such a mess. At least that helped me to get together a longer list of projects that did not fail, which I can arrogantly point to. The irony is , that VB has evolved to a point where it had become usable, but less so its greatest users and supporters.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
Quote: Shall I take that shoe and let it collide with your rear side
The "foot in mouth" thing is figurative, but since you seem to be speaking literally, I would hate to deprive you of the opportunity. I live in Salt Lake City, UT near Liberty Park. We can meet at that park at any time of your choosing where we can test Newton's third law to your hearts content.
As long as we can agree that you've conceded your point that "VB is the problem" by saying that the real problem is the devs who never get past it, then I don't think we are in disagreement at all. As a side note, you can attack VB6 and prior all you want, I don't even care if you make silly blanket statements about those versions.
Quote: For your sake, I hope that this is the culture of your workspace.
In my defense, I didn't really have any better options at the time. I would prefer to work in an environment that "separates the men from the boys" so to speak, but for now, that will just have to wait. Even still, we have plenty of very successful products, all written in some form of VB (mostly .Net).
You come across as very angry and mean, so if I offended you please accept my apologies. I'll rescind my comment about you being ignorant and arrogant, as long as it is fully obvious that you are neither.
|
|
|
|
|
You are right. Time to stop. It's been 32 years since I have been in Salt Lake City and if I hop into a plane to fly half way around the world, then I would hopefully come up with a better reason. And no, you did not offend me. When somebody has a problem, he can come right in. Then we close the door and we will never lose a word again about anything that will be said in the next ten minutes. It may be unfair and certainly impolite, but that does not matter. With those things out of the way it's usually no big deal anymore to figure out what to do.
Sasha Laurel wrote: As long as we can agree that you've conceded your point that "VB is the problem"
by saying that the real problem is the devs who never get past it, then I don't
think we are in disagreement at all. Ok, lets agree on that.
Sasha Laurel wrote: As a side note, you can attack VB6 and prior all you want, I don't even care if
you make silly blanket statements about those versions.
No need for that. I don't like to make a religion out of my work and don't want to participate in any holy war over it.
Sasha Laurel wrote: You come across as very angry and mean Angry, yes, but not at you. I did not really notice that I had built up so much steam, but now I'm back on my way to change this.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
Cheers mate. If you ever do make it out here I'll buy you a beer (or OJ, or a cuppa-tea, whatever) We can test Newton's 3rd while we clink the glasses. 
|
|
|
|
|
Or you come here[^]. We have the right kind of glas for that
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
CDP1802 wrote: You are wrong. VB PHP is the problem
FTFY
On a more serious note, I don't think any language is the problem. The problem is the people using them...
|
|
|
|