 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Eero Ahonen" <aer### [at] removethis zbxt net invalid> wrote in message
news:4864edce$1@news.povray.org...
> 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();
> }
My honours project at university had a line of code in it
while (!hellFrozenOver) {
...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mike Raiford wrote:
> 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
Around here it is highly unlikely that a janitor would know how to
program a computer, let alone operate one. This isn't to say people
around here are stupid or anything. They are just generally
computer-illiterate.
> (Of course, I'm joking .... it doesn't work well in a team environment
> to code for job security)
A bit off-topic, but this reminds me of a guy I worked with at the
travel nurse agency. The man worked in the 'computer engineering'
section, along with the manager. His job, as far as I could tell, was to
keep the computers running smoothly, and to archive lists of available
or potentially available nurses. Now maybe I'm missing something here,
but do you really need your own server for that kind of work? Can't you
do those things with conventional computers and storage? Why did we even
need a server when there were only about zero or three people making
travel reservations at any given time? I wonder things these because the
'computer engineer' seemed very self-important, an active preserver of
personal job security. He even cast a contentious look one time when I
helped a lady with her computer's resolution! Odd situation at any rate.
Sam
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Gail Shaw wrote:
> My honours project at university had a line of code in it
>
> while (!hellFrozenOver) {
> ...
...you realise that when hell freezes over, your program is going to
fail in an undefined way, right? (YHF bug?)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Orchid XP v8" <voi### [at] dev null> wrote in message
news:48652fca$1@news.povray.org...
>
> ...you realise that when hell freezes over, your program is going to
> fail in an undefined way, right? (YHF bug?)
>
In the case of that piece of code, it would just not do anything on that
fateful day
The loop in question was the program's main activity loop (Distributed VR
system)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mike Raiford wrote:
> Warp wrote:
>> Gail Shaw <initialsurname@sentech sa dot com> wrote:
>>> Whereas I find the first far too spread out to be able to read easily
>>
>> Compactness does not imply readability. On the contrary.
>>
>
> Case in point:
>
> n=(i<12&&j>=i)?(sqrt(z)*y+j):(y+j*i);
>
> vs
>
> if( i < 12 && j >= i )
> {
> n = sqrt(z) * y + j;
> }
> else
> {
> n = y + j * i;
> }
>
> ;)
I'd like to see the specification that gave rise to that snipped of code. ;)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> Perhaps you forget, the very word "computer" means "device for
> performing mathematical calculations". ;-)
Actually, it means "person whose job it is to do the arithmetic." Only
after they automated it did it refer to a machine. :-)
--
Darren New / San Diego, CA, USA (PST)
Helpful housekeeping hints:
Check your feather pillows for holes
before putting them in the washing machine.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Gail Shaw wrote:
> "Eero Ahonen" <aer### [at] removethis zbxt net invalid> wrote in message
> news:4864edce$1@news.povray.org...
>> 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();
>> }
>
> My honours project at university had a line of code in it
>
> while (!hellFrozenOver) {
> ...
>
>
was that before or after Lordi won?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |