Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Programming Languages Suck
Index -> General Programming
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wtd




PostPosted: Sun Oct 30, 2005 1:41 pm   Post subject: Programming Languages Suck

Consider this an even-handed companion to my Why Java sucks thread.

Loops

One of the most common uses of a loop is to do something a certain number of times. Often, we don't especially care which reptition we're on. We just want something done.

So, why can't more languages support this? Instead we often have to introduce a useless counter variable.

code:
for (int i = 0; i < 10; i++)
{
   ...


That is so horrifically ugly.

code:
5.times do
   ...


And that is beautiful.
Sponsor
Sponsor
Sponsor
sponsor
goomba




PostPosted: Sun Oct 30, 2005 8:38 pm   Post subject: (No subject)

Probably because Java wants to remain syntactically similar to C. The foreach loop in 1.5 helps a bit when you want to iterate over a list, but I agree that it doesn't compare to the syntax and flexibility of iterations in Python/Ruby.

Which raises the question, why is Java used so much more than Ruby/Python in the "Real World" if it is so inferior?
rizzix




PostPosted: Sun Oct 30, 2005 8:43 pm   Post subject: (No subject)

cuz TIMTOWTDI is real bad in the real world... Wink
beard0




PostPosted: Sun Oct 30, 2005 8:45 pm   Post subject: Re: Programming Languages Suck

wtd wrote:
Consider this an even-handed companion to my Why Java sucks thread.


wtd is talking about all languages in this post.
Cervantes




PostPosted: Sun Oct 30, 2005 8:59 pm   Post subject: Re: Programming Languages Suck

beard0 wrote:
wtd is talking about all languages in this post.

Maybe, but Ruby wins this round. Very Happy
goomba wrote:

Which raises the question, why is Java used so much more than Ruby/Python in the "Real World" if it is so inferior?

Traditions are hard to change...
wtd




PostPosted: Sun Oct 30, 2005 9:11 pm   Post subject: Re: Programming Languages Suck

beard0 wrote:
wtd wrote:
Consider this an even-handed companion to my Why Java sucks thread.


wtd is talking about all languages in this post.


Well, for any given problem there are likely at least a few languages that get it right. The "all" part comes from the fact that none of them get everything right.
wtd




PostPosted: Sun Oct 30, 2005 9:13 pm   Post subject: (No subject)

goomba wrote:
Which raises the question, why is Java used so much more than Ruby/Python in the "Real World" if it is so inferior?


Sun spent a lot of money hyping the heck out of Java, and still does. Several other companies do as well.

I'd say the biggest (though not necessarily the only) reason is that so many people simply haven't either heard of Python or Ruby, or haven't given them a chance.
Dan




PostPosted: Sun Oct 30, 2005 11:14 pm   Post subject: (No subject)

Well the for loop counter var dose make it alot more apreate where the index var is and how to call apone it. I mean in the 2nd case you posted the index var is still there some where you just can not see it (tho it maybe accesable throw other methods). The for aporch makes it so some one viewing or making the code cleary knows how to deal with the index var with out having to know the API or libbrays of the langue.

This may not mean this the for aporch is better but it dose give a reason for using it.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Sponsor
Sponsor
Sponsor
sponsor
Martin




PostPosted: Mon Oct 31, 2005 12:01 am   Post subject: (No subject)

wtd, what do you think the perfect language (syntactically) would look like?
rizzix




PostPosted: Mon Oct 31, 2005 12:02 am   Post subject: Re: Programming Languages Suck

wtd wrote:
Instead we often have to introduce a useless counter variable.

code:
for (int i = 0; i < 10; i++)
{
   ...
I've created many algorithms that make good use of the for ( ; ; ) syntax... there's not need to eliminate it all together.. but sure.. a for (int i : n,m .. p) kind of syntax would be cool.
wtd




PostPosted: Mon Oct 31, 2005 12:32 am   Post subject: (No subject)

Martin wrote:
wtd, what do you think the perfect language (syntactically) would look like?


Haskell is really nice syntactically. The ML languages also have a nice syntax.
Martin




PostPosted: Mon Oct 31, 2005 12:36 am   Post subject: (No subject)

Yeah, Haskell is pretty nifty.
rizzix




PostPosted: Mon Oct 31, 2005 12:37 am   Post subject: (No subject)

Haskell pwnz.
Cervantes




PostPosted: Mon Oct 31, 2005 6:33 pm   Post subject: (No subject)

Hacker Dan wrote:
Well the for loop counter var dose make it alot more apreate where the index var is and how to call apone it. I mean in the 2nd case you posted the index var is still there some where you just can not see it (tho it maybe accesable throw other methods). The for aporch makes it so some one viewing or making the code cleary knows how to deal with the index var with out having to know the API or libbrays of the langue.

This may not mean this the for aporch is better but it dose give a reason for using it.

Yes, but the Ruby example can be extended as well. You can optionally add the block parameter:
code:

5.times do |index|

If you don't want to start at zero:
code:

5.upto( 10 ) do |index|

or
code:

5.downto( 0 ) do |index|

And if you want a different incriment other than 1 or -1,
code:

5.step( 11, 2 ) do |index|


So it becomes a question of somewhat ugly looking syntax that can do everything from the basic configuration, or beautiful syntax that requires more knowledge of the language / more approaches to getting the task done.
MysticVegeta




PostPosted: Mon Nov 07, 2005 3:08 pm   Post subject: (No subject)

If I made a programming language (which is just a thought) I would have the following syntax for it
code:

var <- Variable
of int/of string <- Defines type

array x is 1 to 25 <- selfexplanatory
farray x is 1 to 0 <- flexible




Hmm lets go for the "for" loops
code:
do .... <- a little rip from while and do syntax
when x is 1 to 25 <- same as for x : 1..25


Lets take a look at teh forever loop

code:
neverendingly do
.......


Procedures
code:
organisedArea x -> organisedArea is procedure.....
....
ofcourse there is an end too. finish organisedArea x


Functions
code:
fcn sounds good


This is my idea too bad i am not going to work towards it lol
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 28 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: