|
Posted by Jerry Stuckle on 11/08/07 20:13
Steve wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>> too much space? is there a premium on space in your editor, jerry? would
>>> you like me to post a query i have for running financial statistics here?
>>> i would be more than willing to un-format it so just a single line in
>>> order to save 'virtual' space on the 'virtual' page if you'd like. :)
>>>
>> Don't be an asshole again, Steve. My editor isn't limited, but my screen
>> size is, and that wastes a lot of it.
>
> again? when was i being an asshole at all, jerry? i was sarcastically making
> a point. one of which is that your screen realestate is far less expensive
> than spending the time it takes to debug non-functioning
> queries...especially when the query is more complex that what it seems
> you've written in the course of your experience. you'd probably start by
> *formatting* said query so you could break it down and isolate the problem.
> after all of that's done, you probably would spend a fraction of time fixing
> the actual problem. if it is formatted to begin with, you are less likely to
> introduce problems, more able to expand a query, and very quickly able to
> fix whatever else may ail it.
>
First of all, it didn't come through as sarcastic. If that is how it
was meant, then I apologize.
But this is simple compared to many of the queries I've written in the
past. Try recursive queries in DB2 or Oracle, for instance. Some of
them get very long and very complicated. But I doubt you are even aware
of what a recursive query is.
And I didn't say don't format - you're putting words in my mouth. I
said your method of formatting is lousy.
> if it's that big of a deal, buy an editor with code folding.
>
> again, am i an asshole simply because i have been calmly disagreeing with
> you?
>
It's the way you disagreed.
>
>>> as far as being 'correct by virtually any programmer i [you] know'...that
>>> may be as 'virtual' as the space such a query takes up. as for what is
>>> reported, documented, and written about code formatting - inclusive of
>>> sql - i think you're outnumbered.
>>>
>> Yep, programmers with any sense don't do it that way. The do it similar
>> to:
>>
>> SELECT a,b,c
>> FROM x
>> WHERE y='z';
>>
>> Or something similar. And in the almost 25 years I've been doing SQL, I
>> can probably count on two hands the number of experienced programmers who
>> write SQL as you did. And hundreds who do it the way I learned.
>
> you know what? me too. however, those handful are the ones from whom i
> learned the most. they showed me that consistency, simplicity, and
> manageability are the keys to not only good code, but a successful career.
>
Sure. And what do you do when you have a recursive query with 50
different parameters from 5 joined tables with a half dozen conditions
(not including the joins)? I've had queries run upwards of 2K characters.
Let's see you format THOSE queries the way you espouse and get them on
in a single window in something larger than 1 point font.
> also, in addition to being an asshole for disagreeing with you, jerry, i'm
> now a programmer without any sense...and for simply the same reason?! rof.
>
> i'm chuckling even more now though. don't you notice a difference between
> the example you gave:
>
> select a, b, c
> from x
> where y='z'
>
> and the real formatting issue being discussed here...in the genre of:
>
> select a, b, c from x where y='z'
>
No, it's the difference between
select a, b, c
from x
where y='z'
and
select
a,
b,
c
from
d
where
y='z'
Now - which one is more readable?
>
> hmmmm...the former being formatted in some way, the latter, not at all. and
> i'm senseless?
>
> let's take that example though a bit further and say we're dealing with php
> code. if a function has parameters a, b, and c. you probably write it and
> call it thusly:
>
> function foo($a, $b, $c)
> {
> return true;
> }
>
No, I don't. I write it as
function foo($a, $b, $c) {
return true;
}
> i bet though, that when your parameter names are very long and numerous, you
> either single line them or column-ize them, like this:
>
> function foo(
> $a ,
> $b ,
> $c ,
> ...
> )
> {
> return true;
> }
>
Nope. If it all fits in one line on my screen, I put it on one line.
Otherwise I split it into 2 lines, with the second line indented, such as:
function foo ($a, $b, $c ..... lots more
$x, $y, $z) {
return true;
}
And BTW, if my SQL clause gets too long, I do it the same way.
> and i bet you do the same when defining arrays, right? ask yourself why.
> probably because it is more legible and maintainable, right? if the only
> time you do this is when the function's params are way in the right margin,
> forcing you to scroll to see them all...essencially screen space, i think
> i'll but a gut.
>
Nope. I do arrays similar to the rest.
>>> for the same reasons you should format sql, you format any other language
>>> you write in. i'm sure you've written lots of scripts that are over
>>> several hundred lines. why would you approach writing sql any differently
>>> than other language? just curious jerry. if you have no other explanation
>>> than what you've stated, you've hardly made a case...except a 'special
>>> case' which is therefore, a logical fallacy.
>> I never said you shouldn't format SQL. I said the way you did it is
>> stupid.
>
> wow! i should have gotten 'stupid' from "I don't agree with your method..."?
> i'm really going to have to read your posts with a lot more inferencing than
> is normally due any other human being. that is, unless you are saying it is
> stupid now...as opposed to "i said...".
>
Well, that's what I think about your formatting method. It wastes all
kinds of screen space, making it much harder to see the big picture.
> likewise, rather than bash the way i format sql, wouldn't it have been more
> helpful to address the point of FORMATTING sql - which was my point to begin
> with. further, providing an example of the way YOU format sql would have
> expanded the topic for the op. hell, i may even side with YOUR version of
> formatting sql v. the way I format mine. but, simply leaving it at 'your way
> is stupid, you're an asshole and senseless for disagreeing with me' doesn't
> really help anyone...or, your cause - which i have yet to figure out here
> yet.
>
I did address the point. And I did provide an example. But when you
promote poor formatting practices, I'll call you on it.
>> But like anyone with no argument, you keep trying to put words into my
>> mouth.
>
> wow jerry, i've been stating MY case. i've not even addressed any of your
> points. look at your ONE, SINGLE POST in this thread. what POINT (much less
> points, plural) did you actually make? you said you disagree with me. that's
> fine. i simply added more reasons for you/anyone to understand why i and
> others do things the way we do.
>
> so please, quote me and the words you are proposing that i'm putting in your
> mouth.
>
You stated that I advocated no formatting of the sql statements. That
is not what I said. Go back and read.
> i hope you are not projecting on me here from some other thread where some
> other person has bashed you. as you know, i have no beef with you. and
> throughout this thread in rebuttal with you and darko, i've been unusually
> polite. hence my puzzlement of being called an asshole, senseless, and
> stupid. how did i get your ire up so?
>
>
>
No, I'm addressing you and what you said.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|