Date: Tue, 9 May 2006 19:48:30 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: OT: Lines of code per day...
In-Reply-To: <01ec01c6739e$a4208720$0202fea9@alan>
Content-Type: text/plain; format=flowed
ALan ,
I would say they suffer equally but for different reasons, but that is my
opinion. I would prefer one SQL statement to do what was done in the code
below by three steps.
What I see as the defining measure is the program design. Which means our
question should be how do you judge the quality characteritics of a program?
Code Complete as well as other books go indepth on program design and how
high quality a program is. We could say that a program must follow a set of
principles which gets half way there but there is the issue of flow or is
this method better than that. These are subjective and deffinity in the eye
of teh beholder.
In the end it is still a subjective call, so what you may grade as high
quality I may grade as low quality. Which means either we are placing
different values on different characteristics or that our scale is
different. Well the first is easy to over come all one needs to do first is
define a ranking of which characteristics they want to ephisize more and
which ones they dont care to emphisize as much. Once that is done your
still left with the problem of getting the values one assigns to the
different characteristics equaled out between people. Which leads us back
to the original question which is how would you numerically judge the
program? And the answer that id not a good method for doing this. Well
until person A can tell person B how much person B like chocolate ice cream
over vanilla ice cream and do it as well as or better than person B can.
Since this highly unlikely to happen the best we an do is check that best
practrices and any coding standards have been followed and finally make a
judgement call as to the design.
Toby Dunn
From: Alan Churchill <SASL001@SAVIAN.NET>
Reply-To: Alan Churchill <SASL001@SAVIAN.NET>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: OT: Lines of code per day...
Date: Tue, 9 May 2006 13:27:41 -0600
I'm going to stop hanging out here with you PhD types ;-] You got me.
Ok, how do we know good programming from bad? Well, it is subjective...very
subjective.
Since many on the list have been kind enough to provide me with really,
really 'bad' SAS code which I am parsing and cleaning up, I can state what I
think is bad code...but formatting-wise, not logic-wise.
Let's look at a real example.
I think this is horrible code in the way it is laid out:
===========================================================
proc sort data=parmdl.peer_group out=work._peer_group;
where co_id^='';
by co_id;
run;
proc sort data=sasdl.company_null out=work._company;
by co_id;
run;
data work._company(drop=mtg_id);
length PEERGRP $2 CO_ID_NUM 8;
format PEERGRP $2. co_id_num 15.2;
label PEERGRP= 'Peer Group ID' CO_ID_NUM= 'Numeric Company ID';
merge work._company(in=a) work._peer_group(in=b);
by co_id;
if a and b;
PEERGRP = trim(left(pg_id))||trim(left(mtg_id));
CO_ID_NUM = input(co_id,6.);
coname = put(co_id,company.);
if peergrp='' then delete;
run;
===========================================================
However, it may be really cool code logically and do something important.
Plus some people may like this style and not view it as an issue.
Here is the same code, cleaned by a code cleaner:
===========================================================
proc sort data=parmdl.peer_group out=work._peer_group;
where co_id^='';
by co_id;
run;
proc sort data=sasdl.company_null out=work._company;
by co_id;
run;
/*====================================================================*
| Data step : |
| Purpose : |
| Created by: |
| History : |
*====================================================================*/
data work._company(drop=mtg_id);
length PEERGRP $2 CO_ID_NUM 8;
format PEERGRP $2. co_id_num 15.2;
label PEERGRP= 'Peer Group ID' CO_ID_NUM= 'Numeric Company ID';
merge work._company(in=a) work._peer_group(in=b);
by co_id;
if a and b;
PEERGRP = trim(left(pg_id))||trim(left(mtg_id));
CO_ID_NUM = input(co_id,6.);
coname = put(co_id,company.);
if peergrp='' then
delete;
run;
====================================================================
I would argue that the style shown by the code cleaner is better but that is
my opinion.
The other challenge is that code styles and methods are constantly changing
so measurements aren't valid over time so what do you base it upon? I like
mixing C# and SAS, others would consider that heresy. I see it as a best of
both worlds viewpoint. How is the value measured appropriately?
I can say that a person is smart but what defines intelligence? Perhaps just
in the eye of the beholder.
Alan
Alan Churchill
Savian "Bridging SAS and Microsoft Technologies"
www.savian.net
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Peter
Flom
Sent: Tuesday, May 09, 2006 1:01 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: OT: Lines of code per day...
>>> "Alan Churchill" <SASL001@savian.net> 5/9/2006 2:49 pm >>> wrote
<<<
Unfortunately Peter, this doesn't work well either IMO.
>>>
Maybe not, but see below
<<<
For example, I had a great programmer once work on a problem on and off
for 6 weeks without solving it. The issue was that he tried too hard to
view it mathematically rather than stepping back and viewing it
holistically. He had made a fundamental error on step 1 and he then
wasted the rest of the time chasing bugs that weren't real. Once the
issue was pointed out, it was solved in 30 minutes.
BTW, I always liked comp sci people mixed with liberal arts folks
because it made a stronger team for solving problems.
Programming is often closer to black arts than anything resembling a
process. I can't imagine how you can measure it and I've never seen
programmers measured.
>>>
Well, you have seen programmers measured. In fact, you just did it.
You said "I had a great programmer once....", that is measurement. How
did you know he was a 'great' programmer?
Although, as I said, I know little about programming, I think there
would be general agreement here that Ian is a great SAS programmer. Why
would there be agreement? We must be basing our judgement on SOMETHING,
and somehow we are measuring programming skill.
So, I'll pose these question to the programmers here:
What do you mean when you say something like "Ian is a great
programmer"?
Why do all (I would guess ALL) of you agree on this?
or, put it another way. If you looked at some code by, say,
Donald Knuth (to stop using Ian as an example) would you be fairly
confident that you could tell it was good code?
How?
To get back to my inbox task, obviously, you need a bunch of tasks, for
reliability, but I don't see why it couldn't work
Peter