Re: Is there a programming language that is combination of Python andBasic?

2009-04-19 Thread Hendrik van Rooyen
 Steven D'Aprano steveource.com.au wrote:

COMEFROM on the other hand is just the purest evil imaginable.

*grin* - I expect you say this because it is a bit like COBOL's
alter - you cannot *see* it in place when you read the code, and 
the effect is only apparent at run time after the distant statement 
has been executed.

Kind of fun...

- Hendrik


--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a programming language that is combination of Python andBasic?

2009-04-19 Thread Hendrik van Rooyen
 Aaron Brady casti.@gmail.com wrote:


On Apr 18, 4:44 am, Hendrik van Rooyen m...@microcorp.co.za wrote:

 to untangle some spaghetti code. He did not mention if
 the spaghetti was actually doing it's job, bug free, which
 IMO is the only rational test for the quality of a piece

I don't use 'rational' in the same way.  Do you mean objective?  Do
readability, brevity, simplicity, purity, etc. contribute to quality?
Is program quality equivalent (or identical) to code quality?

This paragraph illustrates the problem, I think:

Is there a significant difference between rational and objective?
Define readability, brevity, simplicity, purity, etc as applied
to the quality of a programme - it leads, inevitably, to a floundering
around in a wash of words.

However, to stop playing Devil's Advocate, there is such a thing
as code quality, but it cannot be defined, just like quality in general 
terms cannot be defined - as soon as you try, it turns to dross in
your hands.  Read Robert Pfirsig's Zen and the art of motorcycle
maintenance for a full explanation of this effect.

 I do not agree with the reasoning that effectively says:
 If it is difficult to comprehend, it must be wrong

Wrong no, but impractical, possibly or probably or almost certainly,
notwithstanding the subject-dependence of ease of comprehension.
Simple code is more future-resilient than that which is difficult to
comprehend, even holding the language (version) constant.  It is a

I think that the emphasis on future proofing code is actually overrated.

We try to code as if we are building pyramids, for all time, but the sad
experience is that only a tiny percentage of application code written has
a life of longer than about eight years.

8--

that of exploration, pioneering, research, and development.  However,
even in simplest terms, some structures e.g. recursion, may be
difficult to comprehend, but that doesn't mean they would be better
more complicated.

This is true - the one does not imply the other, but the subtlety is that
it cuts either way - not more complicated, and not more simple.  One
has to strike a balance, and this is closer to an art than a science.
That said, however, throwing out the goto ( or even the more intriguing
comefrom ) is forcing the artist to paint while removing an element from
his palette - he has to work around the lack.

- Hendrik



--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a programming language that is combination of Python andBasic?

2009-04-19 Thread Hendrik van Rooyen
 BJörn Lindqvist b...@gmail.com wrote:

I can somewhat sympathise with the op, neither python nor any other
mainstream language can still do this:

SCREEN 13
PSET 160,100,255

Oh come on! Don't be like that!
Tell us what it does, please.

- Hendrik

--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a programming language that is combination of Python andBasic?

2009-04-19 Thread Hendrik van Rooyen
Mensanator mens...@aol.com wrote:

8 -- description of bugs in spaghetti ---

Looks like that design really needed sorting out!

A programmer once said to me Why should I run it, I know
how it works, I wrote it.

Are you serious? 
In my opinion, anybody who says this is not a programmer,
but merely an arrogant idiot with a lot of misplaced self-
confidence - somewhat like a permanent force corporal.


My reply: You only THINK you know how it works. _I_, on
the other hand, ACTUALLY know how it works because I've
run it.

How did you manage to keep your reply so meek?
You must be a really well brought up person.
:-)

- Hendrik


--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a programming language that is combination of Python andBasic?

2009-04-19 Thread Aaron Brady
On Apr 19, 3:05 am, Hendrik van Rooyen m...@microcorp.co.za wrote:
  Aaron Brady casti.@gmail.com wrote:

 On Apr 18, 4:44 am, Hendrik van Rooyen m...@microcorp.co.za wrote:

  to untangle some spaghetti code. He did not mention if
  the spaghetti was actually doing it's job, bug free, which
  IMO is the only rational test for the quality of a piece

 I don't use 'rational' in the same way.  Do you mean objective?  Do
 readability, brevity, simplicity, purity, etc. contribute to quality?
 Is program quality equivalent (or identical) to code quality?

 This paragraph illustrates the problem, I think:

 Is there a significant difference between rational and objective?
 Define readability, brevity, simplicity, purity, etc as applied
 to the quality of a programme - it leads, inevitably, to a floundering
 around in a wash of words.

It is an old philosopher's problem, that is, a problem of old
philosophers: do all rational wo/men behave the same given the same
situations, or more specifically, analogously given related
situations?

Rational and objective are related, I think.  An objective test of
code would be a process anyone can follow and derive the same result,
such as how many identifiers it contains.  A rational test involves
some sort of abstraction of humans, such as what the ultimately
rational human likes most, etc.  Objective partial credit on an exam,
for example, must come from a black-and-white rubric with exactly no
room for interpretation.  Rational partial credit could involve
inferences, guesses, and context, esp. acquaintance with the taker.

I agree that many of those traits are matters of degree and multi-
dimensional.  I am looking for an objective metric of code: code X has
traits P, Q, and R.  Period.  It would probably be simpler to start
describing code objectively, rather than trying to square-peg-round-
hole existing words.  However, there may be no objective test of
especially large sizes of code, and may fall to some sort of
interpretation or assessment of the most rational wo/man.

If I disagree with your measuring of a code with objective criteria,
we merely walk through the measurement, and resolve our disagreement
from the criteria upon discovering it.  If I disagree with your
measuring of it with rational criteria, we have to take into account
all sorts of trade-offs, such as long-short term, one-many readers,
different consequences, etc.  I'm speculating a little bit in defining
those words.

I advance that two equifunctional programs (same input- same output)
can be compared w.r.t. brevity, to take an example, up to isomorphism
of identifier names, control structures, and statement order.  That
is, we can determine how brief code X is, disregarding identifier
names, and statement order where irrelevant.  Control structure
brevity might be something we're trying to measure:

while 1:
  if cond(): break

while not cond():
  ...

Are these equally brief, assuming they accomplish the same thing?  If
we don't have unanimous agreement on the answer to that question, we
must conclude that even brevity is a composite trait and we'll have to
start simpler.  A theory of traits would have to make concrete
predictions about *something*.  If some code has trait P, it will Q.

 However, to stop playing Devil's Advocate, there is such a thing
 as code quality, but it cannot be defined, just like quality in general
 terms cannot be defined - as soon as you try, it turns to dross in
 your hands.  Read Robert Pfirsig's Zen and the art of motorcycle
 maintenance for a full explanation of this effect.

Are you saying that quality reduces to how pleasant a particular
reader, or composite of multiple readers, finds the code?

In the 1960s, programmers gave goto statements an average rating of 6
out of 10, 10 being most pleasing.  In the 70s, that rating dropped to
5 out of 10.  Subroutines were initially disliked, but came to be
favored, advancing from 4/10 in the 60s to 7/10 in the 80s and on.
Possible confounding variables include the increase in processor speed
and thus the increased forgivingness of running time of gosubs; the
prevalence of languages capable of generating subroutine calls; and
the efficiency of the particular calls generated, surveys of which
were not attempted.  --Fabrication

  I do not agree with the reasoning that effectively says:
  If it is difficult to comprehend, it must be wrong

 Wrong no, but impractical, possibly or probably or almost certainly,
 notwithstanding the subject-dependence of ease of comprehension.
 Simple code is more future-resilient than that which is difficult to
 comprehend, even holding the language (version) constant.  It is a

 I think that the emphasis on future proofing code is actually overrated.

 We try to code as if we are building pyramids, for all time, but the sad
 experience is that only a tiny percentage of application code written has
 a life of longer than about eight years.

Project managers should, I judge, be versed in 

Re: Is there a programming language that is combination of Python andBasic?

2009-04-19 Thread Scott David Daniels

Hendrik van Rooyen wrote:

Mensanator mens...@aol.com wrote:

8 -- description of bugs in spaghetti ---

Looks like that design really needed sorting out!


A programmer once said to me Why should I run it, I know
how it works, I wrote it.


Are you serious? 
In my opinion, anybody who says this is not a programmer,

but merely an arrogant idiot with a lot of misplaced self-
confidence - somewhat like a permanent force corporal.


My reply: You only THINK you know how it works. _I_, on
the other hand, ACTUALLY know how it works because I've
run it.


How did you manage to keep your reply so meek?
You must be a really well brought up person.
:-)


Possibly because the proper reply was probably, You only THINK
you know how it works. _I_, on the other hand, know how it behaves,
even if I don't know how it was supposed to work.

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a programming language that is combination of Python andBasic?

2009-04-19 Thread Mensanator
On Apr 19, 3:51�am, Hendrik van Rooyen m...@microcorp.co.za wrote:
 Mensanator mens...@aol.com wrote:

 8 -- description of bugs in spaghetti ---

 Looks like that design really needed sorting out!

Since I was translating to Pascal, I couldn't
emulate that code if I wanted to.


 A programmer once said to me Why should I run it, I know
 how it works, I wrote it.

 Are you serious?

Absolutely.

 In my opinion, anybody who says this is not a programmer,
 but merely an arrogant idiot with a lot of misplaced self-
 confidence - somewhat like a permanent force corporal.

That might have contributed to the reason why we
din't sell too many systems.

The last product developed ran on an IBM RISC PC
using the PICK operating system. We sold nearly one.




 My reply: You only THINK you know how it works. _I_, on
 the other hand, ACTUALLY know how it works because I've
 run it.

 How did you manage to keep your reply so meek?

He got paid more than I did.

 You must be a really well brought up person.
 :-)

But not behind their backs. A program I created that
tested anuther programmer's attempt at making a hash
table was labeled HASHIT.

Said programmer was long gone when the customer called
and wanted to know why his 1 record database was
saying it was full when only 3000 employees had been
entered. Turned out that the hashing algorithm could
not access any more than 3000 of the 1 available
records. This isn't the kind of thing Field Service
is supposed to have to deal with.


 - Hendrik

--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a programming language that is combination of Python andBasic?

2009-04-19 Thread Mensanator
On Apr 19, 10:12�am, Scott David Daniels scott.dani...@acm.org
wrote:
 Hendrik van Rooyen wrote:
  Mensanator mens...@aol.com wrote:

  8 -- description of bugs in spaghetti ---

  Looks like that design really needed sorting out!

  A programmer once said to me Why should I run it, I know
  how it works, I wrote it.

  Are you serious?
  In my opinion, anybody who says this is not a programmer,
  but merely an arrogant idiot with a lot of misplaced self-
  confidence - somewhat like a permanent force corporal.

  My reply: You only THINK you know how it works. _I_, on
  the other hand, ACTUALLY know how it works because I've
  run it.

  How did you manage to keep your reply so meek?
  You must be a really well brought up person.
  :-)

 Possibly because the proper reply was probably, You only THINK
 you know how it works. _I_, on the other hand, know how it behaves,
 even if I don't know how it was supposed to work.

Probably more accurate as his .exe file crashed
immediately when executed. That's what lead me to
supect he never ran it.


 --Scott David Daniels
 scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a programming language that is combination of Python andBasic?

2009-04-18 Thread Hendrik van Rooyen
baykus b..@gmail.com wrote:


 I guess I did not articulate myself well enough. I was just looking
 for a toy to play around. I never suggested that Python+Basic would be
 better than Python and everyone should use it. Python is Python and
 Basic is Basic. I am not comparing them at all. I understand the
 merits of Python but that does not mean I can play with ideas?

Apparently this is not allowed by the CS thought police.

The reasoning is based on an Argument from Authority,
namely the Dijkstra link.

Now it looks to me when I read that article, that the jump
is deprecated because it leads to code that is difficult to
understand, which was based on the difficulty that Dijkstra 
had to construct a co-ordinate system for storing the state
of a program at any given line of code.  This was done 
without giving any reason as to why this should be important,
or even desirable, except towards the end where he wanted to
define instances in time when a count could conceivably be
off by one, and he asserted without proof that having jumps 
in the code makes this more difficult.  Even if this assertion
were to be provably true, it does not really follow that jumps
should be banned, but merely that one runs such a risk if one
were to use them.  Now to some minds, this difficulty may
not be a difficulty at all: 

Processors and interrupt service routines are storing the state
of multiple programmes at arbitrary points in the code, even 
as I type - and every one of those programmes include jumps.
It is a non - issue.

Mensanator had the same complaint based on difficulty 
earlier in this thread, when he described how he struggled
to untangle some spaghetti code.  He did not mention if
the spaghetti was actually doing it's job, bug free, which
IMO is the only rational test for the quality of a piece
of code, because it is the reason for its existence.  
The aesthetics are, like all aesthetics, a matter of opinion.

I do not agree with the reasoning that effectively says:
If it is difficult to comprehend, it must be wrong

If this were to be a tenet, then using the pickle module 
should be forbidden too, as it is a complex piece of 
code that (to me at least) is not easily understood on a 
first read-through.

So does that mean I must stop using pickles?

All Strength to Arnaud for his goto code!
I am looking forward to the gosub and return.
:-)

- Hendrik


--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a programming language that is combination of Python andBasic?

2009-04-18 Thread Aaron Brady
On Apr 18, 4:44 am, Hendrik van Rooyen m...@microcorp.co.za wrote:
 baykus b..@gmail.com wrote:
  I guess I did not articulate myself well enough. I was just looking
  for a toy to play around. I never suggested that Python+Basic would be
  better than Python and everyone should use it. Python is Python and
  Basic is Basic. I am not comparing them at all. I understand the
  merits of Python but that does not mean I can play with ideas?

 Apparently this is not allowed by the CS thought police.

 The reasoning is based on an Argument from Authority,
 namely the Dijkstra link.

Boo, Appeal to Authority!

snip
 to untangle some spaghetti code.  He did not mention if
 the spaghetti was actually doing it's job, bug free, which
 IMO is the only rational test for the quality of a piece

I don't use 'rational' in the same way.  Do you mean objective?  Do
readability, brevity, simplicity, purity, etc. contribute to quality?
Is program quality equivalent (or identical) to code quality?

 of code, because it is the reason for its existence.  
 The aesthetics are, like all aesthetics, a matter of opinion.

 I do not agree with the reasoning that effectively says:
 If it is difficult to comprehend, it must be wrong

Wrong no, but impractical, possibly or probably or almost certainly,
notwithstanding the subject-dependence of ease of comprehension.
Simple code is more future-resilient than that which is difficult to
comprehend, even holding the language (version) constant.  It is a
matter of priorities, which have no objective right.  The amount of
people that can comprehend a code structure is a competing value to
that of exploration, pioneering, research, and development.  However,
even in simplest terms, some structures e.g. recursion, may be
difficult to comprehend, but that doesn't mean they would be better
more complicated.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a programming language that is combination of Python andBasic?

2009-04-18 Thread Brian Blais

On Apr 18, 2009, at 5:44 , Hendrik van Rooyen wrote:


baykus b..@gmail.com wrote:



I guess I did not articulate myself well enough. I was just looking
for a toy to play around. I never suggested that Python+Basic  
would be

better than Python and everyone should use it. Python is Python and
Basic is Basic. I am not comparing them at all. I understand the
merits of Python but that does not mean I can play with ideas?


Apparently this is not allowed by the CS thought police.





to untangle some spaghetti code.  He did not mention if
the spaghetti was actually doing it's job, bug free, which
IMO is the only rational test for the quality of a piece
of code, because it is the reason for its existence.
The aesthetics are, like all aesthetics, a matter of opinion.


Actually, I strongly disagree with this statement.  In my experience,  
there has been very very few pieces of code that I've written that I  
hadn't wanted to *modify* at some point: extend it to a new set of  
circumstances, cover a different case, change the output, etc...  The  
quality of a piece of code is not just if it works right now, but if  
you can reasonably extend it for the future.  I toyed with Perl for a  
year or so, but couldn't give it my full attention.  As a result,  
every few weeks when I wanted to modify what I wrote, I had to re- 
learn the code all over again because the syntax was so terse.  The  
same is true for the typical use of a goto: you have to relearn the  
program, because the flow jumps around.  It's not just about  
aesthetics, but about being able to work with a piece of code.



bb


--
Brian Blais
bbl...@bryant.edu
http://web.bryant.edu/~bblais



--
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a programming language that is combination of Python andBasic?

2009-04-18 Thread Mensanator
On Apr 18, 4:44 am, Hendrik van Rooyen m...@microcorp.co.za wrote:
 baykus b..@gmail.com wrote:
  I guess I did not articulate myself well enough. I was just looking
  for a toy to play around. I never suggested that Python+Basic would be
  better than Python and everyone should use it. Python is Python and
  Basic is Basic. I am not comparing them at all. I understand the
  merits of Python but that does not mean I can play with ideas?

 Apparently this is not allowed by the CS thought police.

 The reasoning is based on an Argument from Authority,
 namely the Dijkstra link.

 Now it looks to me when I read that article, that the jump
 is deprecated because it leads to code that is difficult to
 understand, which was based on the difficulty that Dijkstra
 had to construct a co-ordinate system for storing the state
 of a program at any given line of code.  This was done
 without giving any reason as to why this should be important,
 or even desirable, except towards the end where he wanted to
 define instances in time when a count could conceivably be
 off by one, and he asserted without proof that having jumps
 in the code makes this more difficult.  Even if this assertion
 were to be provably true, it does not really follow that jumps
 should be banned, but merely that one runs such a risk if one
 were to use them.  Now to some minds, this difficulty may
 not be a difficulty at all:

 Processors and interrupt service routines are storing the state
 of multiple programmes at arbitrary points in the code, even
 as I type - and every one of those programmes include jumps.
 It is a non - issue.

 Mensanator had the same complaint based on difficulty
 earlier in this thread, when he described how he struggled
 to untangle some spaghetti code.  He did not mention if
 the spaghetti was actually doing it's job, bug free, which
 IMO is the only rational test for the quality of a piece
 of code, because it is the reason for its existence.  

Oh, the bugs were there, alright. But they tended to be very
subtle, so much so the original author must not have noticed them.
For instance, a players AGILITY attribute affected the player's
probability of hitting the monster he was attacking. This AGILITY
attribute was altered by the quality of the player's armor, heavier
plate armor being more adverse than light leather armor.

In most situations, the adjustment is made once at the start of
the game. Rarely is armor donned or removed during the course
of the game. But it does happen in some games. I wrote one
in which the player is captured and whatever armor he started
the game with is taken away and part of his quest, in aggition to
finding his way out of the dungeon, is to recover all the
artifacts he entered the game with (which are hidden throughout
to encourage wandering all over the layout).

One of the symptoms of the spaghetti code's jumping around instead
of doing subroutine returns was failure of the armor algorithm to
properly adjust the AGILITY when armor is removed. The result was
that AGILITY was only ever adjusted downwards, and never restored
if it was taken off. If the player then subsequently donned it again,
AGILITY would be further reduced.

The same type of subtlty occured with monster COURAGE. Any monster
(including the friendly ones who fought on your side) that didn't
have a COURAGE rating of 100 was supposed to flee the room if a
certain level of damage was taken. Again, because of goto screwups,
such behaviour was rarely seen. Once corrected, it happened quite
frequently, so much so that it affected the overall game itself.

With the entire dynamic of the game beig very different, desingers
estimates on how many monsters to place in a given scenario were
all incorrect.

 The aesthetics are, like all aesthetics, a matter of opinion.

Game design isn't just a matter of aesthetics.


 I do not agree with the reasoning that effectively says:
 If it is difficult to comprehend, it must be wrong

A programmer once said to me Why should I run it, I know
how it works, I wrote it.

My reply: You only THINK you know how it works. _I_, on
the other hand, ACTUALLY know how it works because I've
run it.


 If this were to be a tenet, then using the pickle module
 should be forbidden too, as it is a complex piece of
 code that (to me at least) is not easily understood on a
 first read-through.

 So does that mean I must stop using pickles?

 All Strength to Arnaud for his goto code!
 I am looking forward to the gosub and return.
 :-)

 - Hendrik

--
http://mail.python.org/mailman/listinfo/python-list