Wednesday, December 31, 2008

Re: [BLUG] Looking to study further in computer science

Very quick replies to just the parts that seemed like they were
expecting replies from me.

>You can declare private attributes and methods inside a class by
>prepending "_" to the name. This makes it so someone won't casually be
>able to mess with it from outside the class, but it does not make them
>untouchable; there is a convoluted way of accessing the "private"
>stuff, I know.
>
>I've yet to personally find a single situation where that isn't
>enough, though. I can't even imagine a situation where that's not
>totally sufficient.

Yup, I know, and I actually agree. I often think of Damien Conway's
line in the book "Object Oriented Perl"... in talking about using the
leading underscore for private methods, he says something like "mind
you, it's only a suggestion". And, everyone obeys the suggestions, so
it works just as well in practice, and besides, practically everything
in perl is either open source or written by you, so you could always
go in and tinker with the private methods even if they really were
private... So, it's really more aesthetically that it surprises me.
Perl people seem to use perl's OO features with their tongue in their
cheeks, Python people seem to talk up Python as an awesome OO
language, so I expect them to be more serious about this stuff, even
if it's not really necessary. Maybe I just don't know enough python
people. :)

>> and you still have that "explicit self"
>> thing (c.f. http://beust.com/weblog/archives/000501.html) which is
>> kinda funny in perl but more strange in Python which seems to be more
>> proud of its OO support.
>
>Yeah, that's a little weird to wrap your head around at first, I
>suppose.The weirdest part is just declaring a method to accept an
>argument that you then don't need to pass it. After wrapping my head
>around it the first time, though, and as someone who uses Python
>pretty regularly, it's never been an issue for me.

See above... it's not that it's difficult or anything, I'm just
surprised that it's still there. The main benefit of not having it is
that it encourages you to really think more object oriented...
technically I have no problem with it.

>It's no weirder than the quirks of every other language I've learned,
>though.

true enough.

>Fr'instance, how come English infinitives are two words? How
>come your nouns don't have gender? And what's with all the exceptions
>to the rules??? ;-)

Oh, I definitely discourage programming in English. :)

>Using whitespace in a consistent and significant way greatly increases
>the readability of code, in my not quite so long-lived opinion.
>
>You did it in both your examples below; I *suspect* you're more
>against it being *enforced*, since you probably developed your own
>whitespace style before sitting in front of Python, that against
>significant use of whitespace in general. How off the mark am I?

Again, I'm not saying it makes Python bad. It is a hurdle to me
jumping on its bandwagon. Yes, I have my own whitespace style, but
also occassionally I have reason to violate it. But more to the point
it's like "Huh? Whitespace matters? How? How many whitespace rules
are there? I don't want to learn whitespace rules. OH yeah, I don't
have to because I don't use Python." Again, I'm not saying it's bad,
and I'm sure if one day I actual have occassion to learn Python I'll
end up saying "whatever, it's totally no big deal".

>> 7.times do
>> whatever
>> end
>>
[snip]
>> At least many languages have now copied perl's "foreach $x (1..7)"
>> approach, which is far more readable than the classic C-style syntax
>> that java (foolishly, imho) emulated.
>
>Is this an example of what you mean? (in Python)
>
>for i in range(7):
> whatever

yes, and way more readable than C-style.

>> Having said all that, I'll again say that I can't really recommend
>> Ruby over Python, and they are good for similar kinds of things.
>
>I don't know *anything* about Ruby, really, except that some people
>*really* dig it.

Here's another thing you should learn about Ruby: some people really
hate it! Or at least the fact time some people dig it so much makes
them hate that it's getting better acceptance than they think it
deserves.

>We've got someone here in Fort Wayne who really digs Ruby. He agrees
>with David's sentiment that he greatly prefers Ruby, and that it's
>probably pretty comparable to Python in many ways.

Hey, I don't really know Python, I even suspect I'd like it. I can't
say I greatly prefer Ruby. But I do like many things about Ruby.

David
_______________________________________________
BLUG mailing list
BLUG@linuxfan.com
http://mailman.cs.indiana.edu/mailman/listinfo/blug

No comments: