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

Username:   Password: 
 RegisterRegister   
 Top X reasons to use language Y
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wtd




PostPosted: Wed Sep 29, 2004 6:26 pm   Post subject: Top X reasons to use language Y

I know there are more than a few languages in use here, so I though I'd create a place to sum up the reasons why whatever language you're a fan of should interest everyone else.

Since I don't think anyone else here is an Objective Caml fan yet...


  • Type inferencing - Almost never explicitly write types again. The compiler can figure it out for you, and still make sure your programs are as type safe as any of the languages that require you to explicitly write out types.
  • Multiple inheritance - Multiple inheritance is a pain in the neck with C++. O'Caml solves it in an easy, elegant manner.
  • Partial function application - Applying less than the full number of arguments to a function yields another function which takes the rest of the args. Consider:

    code:
    let print_team_score = Printf.printf "%s: %d points"

    print_team_score "Pathers" 34


    Of course the other side of this is that functions are first class things that can be passed around as easy as any other value.
  • Implicit "interfaces" - If you create a function which takes an object, and you call the "foo" method of that object, then the function will accept any object that has a public "foo" method, but no other objects, and this is caught at compile time.
  • Interactive runtime - If you want to test out a bit of code without going through the step of saving it in a file, then compiling that file, you can test it directly at the prompt and see the result immediately.
  • Anonymous functions - Need to write a quick sort with custom behavior? The sort function in the List module takes a function which returns one, zero, or negative one, and sorts based on the outcome of it.

    A standard ascending sort:

    code:
    List.sort (fun a b -> if a = b then 0 else if a < b then -1 else 1) [6; 4; 9; 1; 2; 3; 8]

Sponsor
Sponsor
Sponsor
sponsor
JHanson90




PostPosted: Wed Sep 29, 2004 9:02 pm   Post subject: Re: Top X reasons to use language Y

wtd wrote:
Since I don't think anyone else here is an Objective Caml fan yet...

Hey well O-Caml is next on my list after Ruby Razz
wtd




PostPosted: Wed Sep 29, 2004 9:02 pm   Post subject: Re: Top X reasons to use language Y

JHanson90 wrote:
wtd wrote:
Since I don't think anyone else here is an Objective Caml fan yet...

Hey well O-Caml is next on my list after Ruby Razz


Good. Smile
wtd




PostPosted: Fri Oct 01, 2004 4:54 pm   Post subject: (No subject)

Now share with us your impressions of Ruby, and its strengths. Smile
Tony




PostPosted: Fri Oct 01, 2004 6:16 pm   Post subject: (No subject)

among the most obvious : Ruby has a preaty name Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
wtd




PostPosted: Fri Oct 01, 2004 8:10 pm   Post subject: (No subject)

tony wrote:
among the most obvious : Ruby has a preaty name Laughing


No wonder there isn't more enthusiasm about O'Caml here... it's hard to see past the "Irish land mammal that spits" thing. Wink
JHanson90




PostPosted: Fri Oct 01, 2004 8:18 pm   Post subject: (No subject)

wtd wrote:
Now share with us your impressions of Ruby, and its strengths. Smile

I'm not excellent at summarizing things, but one thing I really like is how it is so simple yet so powerful. Everything is an object, and you never have to deal with all those darn exceptions that other languages have. Every string, integer, float, and any other data type is an object. With most other languages, you would need to call in seperate methods or functions to return some of the values you're looking for. With Ruby's "everything is an object," the methods you're looking for are built right into the data type. For the length of JHanson90, just type "JHanson90".length. You wanna get rid of the last letter, type "JHanson90".chop. So easy, doesn't require extra fluff, and allows you to get much more done in less time.

For a language like C++, you have to really study and know every darn thing about it before you can begin to create some nice programs. But you don't need to do that with Ruby. Once you learn how things are done one way, it doesn't take much effort to figure out how everything else is done Wink Sure, Java's OO design is good, but what beginner to programming would start with Java? Ruby is totally ideal for beginners because it teaches you what OOP really is without forcing you to learn some extensive language like C++ or Java.

Also, I really like everything that Ruby can do. There's eRuby for the simple embedding of Ruby code into text documents, or you can build a big and powerful website without using PHP, if you're lucky to find a Ruby-friendly host.

My conclusion is that Ruby gets the job done in an organized, elegant, and easy way that any beginner can figure out and any programmer can love.
wtd




PostPosted: Fri Oct 01, 2004 8:21 pm   Post subject: (No subject)

Rootr.com is reasonably Ruby-friendly. They're a bit behind, as their servers use Ruby 1.6.8 rather than 1.8.2, but unless you want to use Ruby on Rails, you should find it adequate.
Sponsor
Sponsor
Sponsor
sponsor
JHanson90




PostPosted: Sat Oct 02, 2004 6:31 pm   Post subject: (No subject)

wtd wrote:
Rootr.com is reasonably Ruby-friendly. They're a bit behind, as their servers use Ruby 1.6.8 rather than 1.8.2, but unless you want to use Ruby on Rails, you should find it adequate.

That host is almost exactly what I'm looking for.... except for the price. (You mean rootr.net, btw.)

It seems reasonable, though. For a minimum of 9.95 per month, I get Perl, Python, Ruby, and PostgreSQL, plus all its other features. That's pretty good. The web space is ok, and its other features are fine.

Do you know of its reliability and speed?
wtd




PostPosted: Sat Oct 02, 2004 6:38 pm   Post subject: (No subject)

Unfortunately they aren't as fast as they used to be. The servers are quite reliable (OpenBSD rocks), but they aren't the fastest things on Earth.

Their tech support is also much less useful than it was of old. Used to be they'd get back to within the hour. Now it can take as much as a week.
wtd




PostPosted: Tue Oct 05, 2004 8:40 pm   Post subject: (No subject)

Eiffel Smile


  • Strongly-typed. The compiler enforces the differences between types.
  • Simple, easy to learn, Pascal-derived syntax. Enforces a "there's one way to do it" style. For instance, there is only one looping construct to learn.
  • Everything's an object. Even basic types like integers are objects.
  • Uniform access means it doesn't matter if a class implements something as a function with no parameters, or a simple variable.
  • Simple, specialized syntax for putting conditions on the input and output of functions and procedures.
  • Generics are both simple and powerful. Moreso than in Java or C++.
  • Multiple inheritance is easy, and feature adaptation prevent name clashes.
  • Eiffel is natively compiled, yielding tremendously fast executables.


Any questions?
JHanson90




PostPosted: Tue Oct 05, 2004 11:55 pm   Post subject: (No subject)

- Strongly typed: why is that a good thing? Or is it?
- You say only one looping construct, so that means that I can't iterate through each element in the array, the same way you would with .each in Ruby or foreach in PHP? Just a for loop for incrementing a key?

EiffelStudio seems to be the only thing that will compile Eiffel code, but like I don't know how it works. It doesn't let me actually open any file, and then editing the file is a whole other matter. Sure I can edit any file with Vim, but how do I go about compiling the .Es without EiffelStudio forcing me to start a "New Project"?
wtd




PostPosted: Wed Oct 06, 2004 12:07 am   Post subject: (No subject)

JHanson90 wrote:
- Strongly typed: why is that a good thing? Or is it?


It is a good thing. It means if I define a procedure like so:

code:
foo(bar : INTEGER) is
   do
      std_output.put_integer(bar)
   end


If I try to give "foo" a floating point number, the program simply won't compile.

Ruby has a different solution for the same problem, and it's a good solution, but so is Eiffel's. Smile

JHanson90 wrote:
- You say only one looping construct, so that means that I can't iterate through each element in the array, the same way you would with .each in Ruby or foreach in PHP? Just a for loop for incrementing a key?


Eiffel's array class does provide iterators.

code:
wooble(arr : ARRAY[INTEGER]) is
   local
      iter : ITERATOR[INTEGER]
   do
      iter := arr.get_new_iterator

      from
         iter.start
      until
         iter.is_off
      loop
         std_output.put_integer(iter.item)
         std_output.put_new_line

         iter.next
      end
   end


JHanson90 wrote:
EiffelStudio seems to be the only thing that will compile Eiffel code, but like I don't know how it works. It doesn't let me actually open any file, and then editing the file is a whole other matter. Sure I can edit any file with Vim, but how do I go about compiling the .Es without EiffelStudio forcing me to start a "New Project"?


You should try the freely available SmartEiffel. It's a purely commandline compiler, and the syntax is similar to GCC.

code:
class
   HELLO_WORLD
creation { ANY }
   make
feature { ANY }
   make is
      do
         std_output.put_string("Hello, world!")
         std_output.put_new_line
      end
end


code:
C:\> compile hello_world.e -o hello_world.exe
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 1  [ 13 Posts ]
Jump to:   


Style:  
Search: