 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> is much more readable than
>
> t1 = y*y
> t2 = y*t1
> t3 = 2*t2
> t4 = a*b
> t5 = 3*t4
> t6 = t3-t5
>
> despite being much more compact. Counter-examples in the opposite
> direction are not hard to find either.
Hey ... that looks familiar.
... I think someone here used to write code exactly like that! 0.o
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Stephen wrote:
> On Fri, 27 Jun 2008 01:26:58 +0300, Eero Ahonen
> <aer### [at] removethis zbxt net invalid> wrote:
>
>> Warp wrote:
>>> I disagree.
>>>
>> Good, 'cause you're wrong.
>
> I can't help but agree with you.
I disagree.
Everyone's wrong!
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Eero Ahonen wrote:
> Tim Nikias wrote:
>>
>> Heh, that reminds me... Some guy actually wrote code like this:
>>
>
> Somehow those variables remind me of what I've decided I'll do at work
> some day, when I'll have a place where it fits:
>
> if (!successful) {
> try_harder();
> }
>
>> Regards,
>> Tim
>
>
try
{
AcheiveYourGoals();
}
catch(DidntSucceedException ex)
{
TryAgain();
}
:p
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
stbenge wrote:
> If I worked for an organization, I would definitely change my style. Of
> course if I were programming for a living, I would probably go to school
> where they would teach me how to write code that people could decipher :)
Write code that others can decipher? Why would you do a thing like that? ;)
Everyone knows that if you code for a living, you code for job
security... you wouldn't want the janitor to take your job, would you? :D
(Of course, I'm joking .... it doesn't work well in a team environment
to code for job security)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Halbert wrote:
> How about Microsoft's engineers starting the whole Hungarian Notation
> convention with Windows programing. (like lpstrFilePath or iRecursion, etc.)
> There seems to be no set standard to it. While the intention is good, a
> beginner may have wonder why some variables have names like lpszDemung or
> lpfnCBack.
There seems to be two standards, one which describes type: lpszString
and one that defines function (sort of): instead of iOptions, it's fOptions.
You don't know how many times I've looked at a function signature, and
seen fSomething on something that should receive bits and wondered why
the hell they want a float, only to look a bit to the left and see that
it is indeed an integer.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mike Raiford wrote:
> try
> {
> AcheiveYourGoals();
> }
> catch(DidntSucceedException ex)
> {
> TryAgain();
> }
try
{
AchieveYourGoals();
}
catch (Failure e)
{
CallAirStrike();
}
// With appologies for Murphy...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mike Raiford wrote:
>
> try
> {
> AcheiveYourGoals();
> }
> catch(DidntSucceedException ex)
> {
> TryAgain();
> }
>
> :p
Would be great, too :). The thing about my code is that at work we have
this department-wide habit that if someone says "this doesn't work" or
"I can't do this" oslt, the first answer is usually "try harder".
--
Eero "Aero" Ahonen
http://www.zbxt.net
aer### [at] removethis zbxt net invalid
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible <voi### [at] dev null> wrote:
> I'd say that there is only a fairly weak correlation (positive or
> negative) between compactness and readability.
> x = 2*y*y*y - 3*a*b
The context was really a multilined program source code, not a
mathematical formula, which your line really is.
Mathematical formulae can often be written compactly because they
a) aren't really program code, and b) there's an established syntax
to write it compactly.
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
> The context was really a multilined program source code, not a
> mathematical formula, which your line really is.
>
> Mathematical formulae can often be written compactly because they
> a) aren't really program code, and b) there's an established syntax
> to write it compactly.
Perhaps you forget, the very word "computer" means "device for
performing mathematical calculations". ;-)
Having programmed with Haskell for a while now, I would contest the
"programs aren't mathematics" assertion. Having played with mathematics
for even longer, I would contest the "established syntax" assertion too!
[Rather, there are several incompatible and variously ambiguous syntaxes
for writing any particular mathematical construct...]
Regardless, I would assert that how "readable" something is depends on
how well it maps to your underlying mental processes - which is rather
independant of the compactness or otherwise of the code. ;-)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mike Raiford wrote:
> Hey ... that looks familiar.
>
> ... I think someone here used to write code exactly like that! 0.o
It's certainly what the compiler transforms your code into - this is
what machines derived from the design of Turing expect. But it is not
necessarily how humans think. ;-)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |