Forum Moderators: bakedjake

Message Too Old, No Replies

Which Language to Learn on Linux

Want to spend a little time on somthing other than PHP

         

Nick_W

8:00 am on Jun 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

I want to spend a little time learning a new language. Ideally I'd like to learn somthing that will let me build and experiment with applications on my Desktop. So, not neccesarily a 'web' language.

C++? -------- is that the one or what?

Thanks

Nick

bird

9:04 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does it come as a stand-alone language you can write programs in for other OSes? Part of the reason I've never played with it is that all I knew about was the full system.

If you just want to play with it, then the full system (eg. on top of Windows) is a lot more fun. The language isn't extremely interesting in my personal opinion. But then, I just don't like the overly verbose Pascal type syntax. The cool part is how it interacts with the system in very unusual and powerful ways.

> Emulators of that system are also available for other OSes.

Any of those other OSes relevant to this forum?

I don't think anything relating to Oberon is really relevant to this forum, even though they appear to have a web browser. The original Oberon hardware "Ceres" never made it out of Wirths institute. But implementations of the system and the language are available for all popular OSes, and then some (there's even a .NET version).

ETH Oberon Home Page [oberon.ethz.ch].

I guess we're digressing from the actual topic of this thread, because Oberon is not a language that I would recommend to Nick_W for his requirements. I'm just kind of nostalgic about it, because I once took a class about object oriented programming with Oberon at ETH. Unfortunately I never happened to run into the master himself, though.

dingman

9:21 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



eg. on top of Windows

Ug. I don't have a Windows machine, and the idea of running an emulator inside an emulator and then trying to *do* anything is rather unpleasant ;) But I'll poke around on the Oberon page you linked this weekend and see if there's anything that looks fun.

drbrain

9:42 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Learn Ruby!

Its clean, OO (from the ground up, not an afterthought or wedged in like Python or Perl, respectively), consistent, has blocks, open classes, reflection/introspection, yada yada.

Consider:

a = ['bananas', 'apples', 'oranges', 'grapes']

a.each do ¦fruit¦
puts "I want to eat #{fruit}"
end

# => I want to each bananas ...

or:

0.upto(100) do ¦i¦
puts "I want ice cream!"
end

# => prints 'I want ice cream!' 101 times

or:

class Array
def sum; inject(0.0) do ¦i, n¦ n + i; end end
def avg; return 0 if self.length.zero?; sum / self.length; end
end

(0..50).map do ¦x¦ x + rand(x) end.avg

# => adds a #sum and #avg methods to Arrays, then creates an array with values 0 to 49, adds a random number between 0 and the value of the array at that index to each index in the array, then computes the average.

ShawnR

10:09 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I know you've already made up your mind, but I thought I'd add this:

The decision on which language to use is dependent on what application you want to build. A language like perl is great for cgi, text processing, and gluing large applications together in enterprise systems... But you wouldn't use it to build a device driver for your new graphics card or a shoot-em-up game. Similarly for Python (or any other language); it is good for some things and bad for others. So what do you wish to do with the language?

SlowMove

10:16 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The decision on which language to use is dependent on what application you want to build.

Ditto. There must be about a million different programming languages. Some programs, like Flash or 3DS Max, even have their own languages built in, but those are special cases. Use what's best for getting the work done.

bird

10:54 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OO (from the ground up, not an afterthought or wedged in like Python or Perl

Python was designed to be OO from the start. However, it doesn't exaggerate the principle just for the sake of it.

a.each do ¦fruit¦
puts "I want to eat #{fruit}"
end

Cool, thanks! Now I know that I don't need to have a closer look at Ruby... ;)
Does Ruby generally "wedge" the control structures into the object model like this? That's a bit too much implicit magic going on for my taste.

To each their own, of course. The mantra of the Ruby fans appears to be: "If it isn't expressed as a method of an object, then it shouldn't happen". If nothing else, then that's definitively consequent!

ShawnR

11:06 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"...Python was designed to be OO from the start..."
I'd tend to agree with Bird. (Although not with the view that Ruby doesn't deserve to be looked at)

Talking of OO languages, I haven't seen anyone suggest Smalltalk. Maybe the Smalltalkers are just so confident they don't feel the need to promote their language; or maybe they want to keep their secret to themselves. ;)

[added: On the other hand, I haven't seen anyone promote Java, so perhaps its just to do with the cross-section of people who are reading this thread compared to the broader cross-section of programmers]

dingman

3:50 pm on Jun 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



perhaps its just to do with the cross-section of people who are reading this thread

I'm sure I'm not the only one who dropped by the thread thinking that I didn't know enough languages to be much use in the advice department, but that languages are cool anyway and I might learn something. And I did :)

I also suspect that this forum does have a somewhat different spread of languages than a random sample of programmers. After all, this is the *nix forum of a webmaster site. We probably all know languages we've found useful because they are well integrated with tools of those trades. Getting Perl and/or PHP set up for these environments is easy, and it's pretty much universal advice to people getting interested in dynamic pages that they learn at least one of those. I understand Python to be pretty easy to set up for that sort of thing, too, though I still have yet to actually pick up my Python book and learn it.

I didn't really expect Lisp to come up, for example, because although I know it has been used for web development I don't think it's widely enough used for the purpose that most people here will have tried it. Of course, I assume someone here has computer interests other than just webmastering, so someone probably has. :)

drbrain

4:50 pm on Jun 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The 'magic' you see is actually very simple and easy to understand (and very, very helpful). For example:

File.open('somefile', 'w') do ¦fp¦
fp << "Some text\n"
end

You don't have to worry about cleanup at all, the file already knows how to do that, and does it for you. If you look inside File.open, you'll see something like this:


def self.open(filename, mode = 'r')
f = File.new(filename, mode) # create a new filehandle
if block_given? then # if you passed in a block
begin
yield f # pass the filehandle to the block
ensure
f.close # make sure the filehandle gets closed
end
else # otherwise, just return the filehandle
return f
end
end

Using iterators via #each is not any different than using a for loop:

for (i = 0; i < array.length; i++) {
printf("I want %s\n", array[i]);
}

You don't have to worry about off-by-one and other counting errors, its all taken care of for you.

I disagree that Python was designed to be OO from the start, it wasn't until very recently that you could subclass from types in C, much of the library is written in a procedural style, and how to break encapsulation is described clearly in the description of Classes. (The opinion of a particular interpreter writer agrees that Python's objects are an afterthought, and I have no reason to disagree with him.)

I feel it would be more accurate to say "Python has OO features".

ShawnR

11:13 pm on Jun 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"...I'm sure I'm not the only one who dropped by the thread thinking that I didn't know enough languages ..."

Sorry, Dingman, I didn't mean my comment ("...perhaps its just to do with the cross-section of people who are reading this thread ...") like that. I just meant that the audience is primarily web developers, not general software application developers, as you pointed out; so the recommendations are biased a bit towards what is useful for web developers (even if those web developers have a lot of knowledge in other languages too).

As for Lisp, I wouldn't expect anyone to recommend it in a general context even if they have tried it. As per my previous post, languages each have their strengths. In some cases those strengths are in general application development, whereas other languages are more suited to very specific domains. My view is that Lisp is very specific to Artificial Intelligence. You'll always get those evangelists who try advocate that their favourite language is suitable for anything, but I think even Lisp advocates would admit that Lisp is very good for some things, but shouldn't be used as a general work-horse.

dingman

11:56 pm on Jun 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry, Dingman, I didn't mean my comment (...) like that.

Huh? I thought I was agreeing with you. I certainly didn't mean to sound offended, since I wasn't.

dingman

12:16 am on Jun 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On a related note, how do people here go about learning new languages? I remember setting out to learn most of the ones I know or have known. (Basic and Pascal are getting kinda faded at this point) Some, especially at first, I learned by taking classes. I think C was the last one I learned that way, as a college Freshman. (Thereafter, they didn't care what language you did your homework in as long as it ran, and the profs would help you debug any language they knew.) More lately, I pick up a book or hit a web site, and give myself a task to accomplish to give my study direction. I've also got one that I must know 'cause I used to turn in homework in it, and I've used it at work, but I have no memory of learning.

bird

12:19 am on Jun 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I feel it would be more accurate to say "Python has OO features".

That's the type of argument that I'd rather try to avoid. There's no "official" definition of what exactly makes one language more OO then another. And it would be an academic distinction anyway. If you ask a Ruby (or Smalltalk) fan, then all other languages are "lesser OO". If you ask a Python programmer, then they'll just say: "I don't care, as long as it works the way I think".

My view is that Lisp is very specific to Artificial Intelligence.

I have done a lot of lisp in a 3d graphics environment in the past. Lisp is a wonderful language for its dynamic nature and the flexible data structures. Then one day I learned object oriented programming (with Oberon), and when I ran into Python a few years later, I was amazed how brilliantly it combined the best of both sides.

Duckula

6:14 pm on Jun 29, 2003 (gmt 0)

10+ Year Member



how do people here go about learning new languages?

To scratch an itch. I learned Python in about a day because I had an extension system in guile for an app of mine. Guile started to not be the right tool for the job, then I rewrote all the scheme code to Python. It's amazing what you can do when you really need to.

Then my C/C++ application for which I had not used any special C++ features needed a GUI. I only knew pure C, but QT was the perfect choice. Then again, I go and learn proper C++.

moltar

6:20 pm on Jun 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Go with Perl. Not only it's very expandable (modules), it also has a free compiler for *nix, Windows, Mac, DOS, etc... many other systems. + It's usefull for web and even for home use.

You'd be amazed how often u find uses for Perl in "home" use. Say, sometimes I need to rename bunch of files into same format, I just write a Perl script to do it for me.

There are unlimited applications of Perl.

Romeo

9:34 pm on Jun 29, 2003 (gmt 0)

10+ Year Member



I for myself like Perl very much.
There is a huge number of function packages at CPAN for a large variety of common and not so common problems, which makes life very easy. And except perhaps for hardcore device driver programming I would like to repeat what I've read somewhere else: If it can't be done in Perl, it is probably not worth doing it anyhow :-)

Regards,
R.

This 46 message thread spans 2 pages: 46