For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > April 2005 > Re: Python or PHP?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Python or PHP?
John Bokma

2005-04-26, 3:59 am

Mike Meyer wrote:

> John Bokma <john@castleamber.com> writes:


>
> Actually, I never showed you this code.


hence *like*, and yes you did, in a footnote.

> In this case, the good rewrite invokes the well-known logical operator
> "not":
>
> if not condition then
> something


unless condition then
something

Weird, we use constructions like that in normal language all the time,
and when we program it's suddenly bloat?

>
> I can't - in being argumentative, you neglected to include it.


*sigh* in your obsession to call me argumentative, your skipped over it:
"it makes the code more readable"

>
> Um, I suggest you brust up on your English skills.

^^^^^

> What you created was a list. Not in Python or Perl, but in English.


I doubt if any Perl programmer in the given context would have any
problem with it, but lets drop it.

> Oh, I understood it.


Sure, is that why you talked about a tuple? But, lets drop it.

> And so far, I've only said *two* things were wrong with Perl. One is
> that it provides more than one way to do things - which point you've
> made for me by arguing about how you did/didn't choose the right one
> in an example.


If you think I gave a wrong example, give the right one. The only reason
for an argument was your lack of knowledge about split and map, which
only tells something about you, not Perl.

> I also said that it's failure to flag assigning the
> output of map/grep (there's that multiple choices thing again)


There is that lack of understanding again: map and grep are two
different things. I can't help if you consider map/grep a *choice*

> to a
> scalar when you wanted a list was bad. You haven't argued that I was
> wrong about Perl in either case.


*sigh* if you want a list, you assign it to something that can handle a
list. If you assing a list to a scalar, you get the count. So if you
want to select items out of a list on a criteria, you use grep in a list
context, if you want to count the items, guess...

>
> So either your assessment of my skills is *way* off, or I'm an
> *amazing* programmer.


If you consider map/grep a multiple choice, what do you think?
(rethorical question).

>
> If it's a restriction, there must be something it restricts you from
> doing. Care to tell me exactly what garbage collection keeps you from
> doing?


real time guaranteed memory allocation/deallocation (which might be
fixed by now in Java)

>
> I guess you haven't had to chase many bugs related to missing free's


In my own code? I can't remember. In code written by other people: in
the cases they forget to free memory they did so many other things wrong
that I sincerly hope they have found other work by now.

> skilled programmers, and makes wrong choices painful. TMTOWTDI makes
> wrong choices - or ugly code - easy.


Especially if one keeps mixing up map and grep :-D

> Which is one of the reasons that
> multiple nearly identical constructs is a bad design.


Worse is when self proclaimed perl programmers call map and grep
identical constructs...

> So the jvm implementations you're familiar with have really bad
> garbage collectors.


I have no idea if this has changed recently. The last thing I read about
it is that there are 4 kinds of garbage collection one can select in
Sun's implementation.

> A good programmer won't immediately abandon either
> Java or garbage collection. They'd check out other implementations of
> the jvm to see if one of those has a better garbage collector.


Uhm, people often pick Java because of write once, run everywhere. So
that is not always, or even rarely an option.

> another. There are probably others as well. You can't simply tag one
> as "better" without knowing what the problem domain is.


I didn't say better, what I meant: there are situations real time
free/alloc is prefered, unless my knowledge of gc in general is
outdated.

>
> You make my case for me. You write in a subset of Perl that excludes
> "foreach". Is that the "absolute beginner" or the "beginner" subet?
> Or maybe it's a subset that doesn't depend on the skill level of the
> programmer.


"The foreach keyword is just a synonym for the for keyword, so you can
just use foreach and for interchangeably, whichever you think is more
readable in a given situation" (Programming Perl, 3rd edition, p118)

>
> No, I wrote systems adminstration utilities in Perl 3. I wrote web
> application in Perl 4. I just maintain Perl 5. Your "basic mistakes"
> was forgetting the warts on strip. BFD.


The BFD was calling map / grep a *choice*. I am not sure about for and
foreach, it could be that you call for $item ( @list ) a foreach loop,
which I hope. Otherwise, if you really thought there where two
*different* loop ops (as you wrote) then there is another BFD to add.

>
> So you write all your code yourself,


Ok, let me rephrase that: think about that for a long time.

>
> I got stuck with the latest version of Perl that was available. It was
> a major improvement over shell scripts. That's not saying a lot, even
> today - and shell scripting has improved since then.


Perl 1.0?

>
> Ok, ask in both groups. See how many people you find that maintain
> both who feel that each is better. I'm positive you'll find the
> majority who do both find Python programs more maintainable.


I just did (asking). And hope to be able to answer your question in a
year or so. Oh, and I want to add to your latter sentence: code written
by programmers who didn't learn Perl in 3 hours by downloading and
editing CGI scripts.

>
> Nope. A quick survey of a toolset is all that's needed to make a first
> approximation as to it's quality - to someone who's familiar with
> enough toolsets, anyway.


Weird: I am going study Python for at least one year. Unless you call
that a quick survey :-D.

> A good understanding of toolset design allows you to point out flaws
> in a toolset without becoming intimately familiar with it. For
> instance, mutliple nearly identical ways to express the same construct
> is always a flaw in a toolset. Which has been the point I've been
> making the whole time.


So a hammer is a bad tool, since one can use a scewdriver...

I always wondered why an artist, like for example a painter, has so many
nearly identical tools...

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com