Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 16th, 2006, 9:23 PM   #31
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
6.factorial is actually written and invoked as the integer method, factorial (6), right? While it's simple enough not to be too confusing, it's really merely cute and not an addition of power or even of ease. I don't mean to be recalcitrant about it, but it's precisely the sort of thing I'm talking about. You have to adapt a person to x.f() when the person is perfectly familiar with f(x), and adapt 'em for no real gain.

I'm not saying that Ruby is alone in this effort. I'm not enthralled by Python's use of the term, comprehension. I have to admit that it's accurate, at a stretch. Mostly, we mentally interpret "comprehension" as "an ability to understand the meaning or importance of something", even though there IS the definition, "the ability to give meaning to information". One could stretch that to Python's usage, but I think I would have cast about for more common terminology. (By the same token, I'd never have named the C++ thangy "reference" -- it effs up a perfectly good and widely-useful term )
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 16th, 2006, 9:36 PM   #32
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 646
Rep Power: 4 Jessehk is on a distinguished road
Quote:
Originally Posted by DaWei
6.factorial is actually written and invoked as the integer method, factorial (6), right? While it's simple enough not to be too confusing, it's really merely cute and not an addition of power or even of ease. I don't mean to be recalcitrant about it, but it's precisely the sort of thing I'm talking about. You have to adapt a person to x.f() when the person is perfectly familiar with f(x), and adapt 'em for no real gain.
This pretty much demonstrates your point, but this is how 3.factorial would be written:

class Integer
	def factorial
		(1..self).inject(1) { |product, each| product * each }
	end
end

All I can say is that I definitely understand where you're coming from. :p
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Old May 16th, 2006, 10:16 PM   #33
gumbyman31
Newbie
 
Join Date: May 2006
Location: Inside
Posts: 14
Rep Power: 0 gumbyman31 is on a distinguished road
Send a message via AIM to gumbyman31
I'd say C++, then Python. I guess I'm still sorta new to both, but I started on C++. It makes everything else so easy. As for OS, I perfer Mac OS X, because it's based off of unix, so it's the best of both worlds. Outside of that, Feodra or Ubuntu are good Linux distros.
__________________
Use the best: Linux for servers, Mac for graphics, Windows for Solitaire.
gumbyman31 is offline   Reply With Quote
Old May 17th, 2006, 4:15 AM   #34
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Regarding Ruby and Python, I find, like DaWei did, that Python has a syntax that is more easily understandable. Ruby is more powerful than Python with its blocks and continuation support and whatnot, but you can see the Perl influences in Ruby that add messy ambiguity to the language. For instance, brackets are optional for function calls ("x.y z" is the same as "x.y(z)"), and returns are optional for methods (by default, the last object referenced is used).

Also, as DaWei points out, whilst blocks are powerful, they can also be difficult to understand. List comprehensions are less powerful, but more easily read by human beings.

Ruby's object model, on the other hand, is very nice indeed, and seems a lot cleaner than Python's. You can also alter base classes like "string" in Ruby, which you cannot in Python (by design). Ruby's way of customising classes and objects seems more natural and less laboured than how Python achieves it:

In ruby:
foo = SomeClass.new

class <<foo
    def extraFunction
        "An extra function"
    end
end
In Python:
foo = SomeClass()

def extra_function(self):
    return "An extra function"

foo.extra_function = extra_function
On the other hand, I guess Python's approach is more logical.

As for which to use first, Python or C++, I'm for Python on the sole reason that it's easier to learn, and gives faster results to the beginning student.
Arevos is offline   Reply With Quote
Old Jun 13th, 2006, 11:30 PM   #35
ShadowAssasin
Programmer
 
ShadowAssasin's Avatar
 
Join Date: Jun 2006
Location: New York
Posts: 43
Rep Power: 0 ShadowAssasin is on a distinguished road
yes i know this thread is a little old but whatever.
I've kept hearing about ruby and ruby on rails and how it was great and everything but I guess I haven't looked it over enough to find a reason to use it instead of python. Python to me is basically a new and improved, object oriented perl, and it doesn't force you to be object oriented like java does. You do whatever the hell you want. And the whitespace thing, I dont even notice that anymore. I like it as it forces you to write neat, readable code unlike that perl mess; there was actually a contest to see who could write the most unreadable perl code; forgot who created it... The best thing about it to me is it's polymorphism:
i = ['3', '2', '1']
i = 'astring'
i = {}
i = aclass()
i = 'whatever_friggin'_want'

I started to learn c++ first, mostly everything else will seem easy after that and you'll appreciate python/ruby more. In the real world it works the same way, you have to be a coder(detail) for a while before becoming an analyst(abstraction). (you can also be datailed in python if you want, like I said it lets you do whatever you want)
__________________
It's not complex if you know what you're doing...
ShadowAssasin is offline   Reply With Quote
Old Jun 14th, 2006, 12:18 AM   #36
frankish
Hobbyist Programmer
 
frankish's Avatar
 
Join Date: Oct 2005
Location: Ohio
Posts: 177
Rep Power: 0 frankish is an unknown quantity at this point
To tell you the truth I don't like either of them but if I had to go with one I'd choose C++.
frankish is offline   Reply With Quote
Old Jun 14th, 2006, 5:52 PM   #37
ShadowAssasin
Programmer
 
ShadowAssasin's Avatar
 
Join Date: Jun 2006
Location: New York
Posts: 43
Rep Power: 0 ShadowAssasin is on a distinguished road
What language do you like then? (why?)
__________________
It's not complex if you know what you're doing...
ShadowAssasin is offline   Reply With Quote
Old Jun 14th, 2006, 7:19 PM   #38
Mad_guy
Hobbyist Programmer
 
Mad_guy's Avatar
 
Join Date: Oct 2004
Location: Sandstorm, Techno Club
Posts: 239
Rep Power: 5 Mad_guy is on a distinguished road
Send a message via AIM to Mad_guy Send a message via MSN to Mad_guy
Quote:
unlike that perl mess; there was actually a contest to see who could write the most unreadable perl code; forgot who created it...
There've been contests like that in *tons* of languages. Never heard of the IOCCC? It's fairly crazy.
__________________
os: mac os 10.5.4
revision control: git
editor: emacs

site
Mad_guy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:15 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC