View Full Version : Help decide on scripting language to learn...
imported_atlantis
09-02-2004, 10:59 AM
Hey all! :D
I'm a newb here and to the world of scripting languages as well! :D
I normally work with HTML and some QBasic (at school, very umm... basic lol).
I wanted to get into programming for fun. I looked into C/C++ and Java first but decided they were too much for me for fun. And then I looked into stuff like Python and Perl.
I thought Python was the best from what I read. But Perl, I used perl scripts in my site (well downloaded of course) and I know it's supported widely. At first I wanted to go for GUI programming (I work on both Linux and Windows), but then I decided I'm more into Web and graphical stuff.
Python was ALL right, except I don't know if I can build websites with it :O, and if many hosts support it. My current one doesn't.
Now, these is where I wanted help. I wanted select a language that's easy to learn, one I can work with locally in my Linux (Mandrake 8.2) or Windows (XP SP1) box, powerful enough so it'll atleast be useful, easy to run so I can use it on many platform. I would greatly appreciate embedding into HTML of some sort, so I could make sites with it. :rolleyes:
My options, just the ones I rounded off to, are PHP, Perl and Python.
Perl, I read is rather difficult to learn. Is this true? And PHP, is it only for databases? I don't even know what's the use of databases! lol. And what's with all the Apache web server and stuff. (It's scaring me a bit lol). So...
You can consider me a complete newb in programming even though I do some QB. Most importantly, I want to have fun programming my stuff :D (lol so no console-only stuff for me lol)
Any suggestions?
Oh, and hey everyone! *does the new member wave*
And thanks in advance for your interest :)
Whiteknight
09-02-2004, 03:44 PM
alot of people on these boards are going to immediately say python, and thats not an entirely bad sentiment. python has many good qualities. I personally say perl, a trade-off in less elegant code for more (at least perceived) functionality.
php is not "only for databases" but it is only for the web. php was created as an offshoot of the apache server project to be used as a high-powered scripting language for websites. PHP is very powerfull, but can't be used much (at least not easily) outside of a web server.
PHP and perl have very very similar syntaxs, expescially at first, because they are very heavily related. in some senses, php is the direct descendant of Perl, although people wont always agree on this.
Python is very similar, at least in spirit. it can easily be used for web pages, so long as you install a properly configured interpreter, and properly configure your server. some popular sites--most notably Google--run on python.
if you want to do more then web design, then dont look at php. if you want more readable, more elegant syntax, dont do perl. if you are willing to trade in some elegance for more raw power, then dont do python.
iDxMan
09-03-2004, 01:25 AM
No time for a long post, but I'll point out that PHP can easily be used from the command-line just like perl. While my preference is to use perl for various tasks and PHP for others I have the option of going PHP-only. (assuming the CLI version is installed)
-r
imported_atlantis
09-03-2004, 02:59 AM
Hey :D
Thanks for your ideas. My thoghts are tilting towards Perl for a number of reasons.
> I can create websites (which I do with HTML + CSS now) with Perl embedded
> Many hosts support Perl (including the one I'm on)
> There's use outside my site as well, like in my linux box
> Simple GUI applications, I read, are possible with GTK-Perl and stuff...
A few questions, then. Can PHP run without Apache or MySQL (or other 'database' stuff)?
The reason Python kind of intimidated me (maybe that's not the right word), is because it had so may dependencies! I downloaded a Python script and ran it and it didn't run (on Mandrake). It was a simple one, not graphical or anything. Besides, many servers don't have it installed so I would depend on my server to create my sites.
I read as well that CPAN can make magic. Well, something of that sort. I appreciate your input(s) :) Please keep them coming...
sans-hubris
09-03-2004, 03:00 AM
Originally posted by Whiteknight
it is only for the web...can't be used much (at least not easily) outside of a web server. This is such a myth. PHP can very easily be used outside of web applications. In fact, it can very easily be used as a regular script from the command line. It is, however, uniquely well suited for web development, unlike Perl or Python.
http://us4.php.net/features.commandline
Anyway, PHP isn't too difficult to learn. Actually, it's quite the opposite. I would almost dare say that it's easier than Python in many respects.
Perl is not hard to learn, and does not have to be unreadable. Its purpose is to give the programmer the freedom to write in almost any style (s)he wants. This means that readability is the responsibility of the programmer. This can sometimes be a good thing. Some problems can be more easily understood with a particular coding style.
Python believes in the "One True Style," which does actually make maintenance much easier, usually. It is possible, though, to write unreadable code in Python. It tries hard to look like pseudo-code where the idea being that the algorithm stands out well without having to worry about syntax. However, ironically, that's part of the problem of Python. Since it does believe in the "One True Style," it is syntactically picky. This catches many off guard. I think it is easier for people without a background in programming to learn Python than it is for programmers. Or maybe that's just me.
imported_atlantis
09-03-2004, 03:29 AM
PHP, well I think I at this point from what I've read from all your posts, should be temporarily kind of, eliminated. I want a strong shell scripting, one I can even program in my PDA. Well, not run or anything, just prog. I know that's possible with PHP as well, but it just seems so... web-ish. But from what I read and what all of you've said, It should VERY interesting :D.
I like to have some freedom in syntaxing (?), and so, I think I'll give Perl one more vote there. I'm coming closer to making that decisions. Perl looks the strongest and most appropriate for me :)
Thanks sans-hubris, you're analysis helped :D
Please keep your ideas coming in, devs ;)
Whiteknight
09-03-2004, 09:18 AM
I personally use Perl out of the three of them, not that I wouldnt like to learn Python or php (infact i have interpreters for both of them downloaded) but that i just dont have time or energy now to learn a new language.
I love perl, and I mostly use it for short-ish system scripts to manhandle files and folders, or do things that require alot of string manipulation (whihc i see as Perl's strong point). like Sans' said, perl doesnt have to be "unreadable" but sometimes it is nice to just throw together a fast, dirty script in a jiff. Without alot of preplanning, and a solid syntactical style however, it can be folly to write a perl script more then a screen long, as it can be a little tricky to decifer, so i dont write long perl program unless i have a clear vision in mind.
imported_atlantis
09-03-2004, 11:46 AM
Right :D I'll consider that. I tried doing some Perl on Kate editor in linux and it was fun :D
I found the fact that you could type $newvar+=3 instead of the usual $newvar = $newvar + 3.
For Windows, I've found an excellent editor, EnginSite Perl Editor Lite (Freeware) but for Linux I use Kate. Any other good open-source IDE that can run the codes I write internally?
Oh, and do you recommend books from
1) SAMS Publishing, 2) O'Reilly or 3) ... For Dummies, or any?
I guess I'll be going with Perl. Thanks for all your help! :D
As always, please post on any other thoughts you have :)
Whiteknight
09-03-2004, 12:12 PM
O'Reilly books are generally the quintessential perl source, and Larry Wall, the creator of perl has authored and co-authored several books by them. It can be very interesting to get the perspective of the language's creator.
by them, i have a book called "Learning Perl" which is like the beginner-level book for Perl, and it's very good. I've been thinking of upgrading to the book "programming Perl" which is supposed to be the official perl bible of sorts.
imported_atlantis
09-03-2004, 01:32 PM
Ah, I think I saw "Learning Perl" with with some blue font at a store, I'll see if I can get it. Can't do that soon though. Our capital's under curfew from what happened in Iraq (12 Nepalis killed). Geez...
Sorry about the non-topic, it had to be mentioned.
Oh and thanks Whiteknight, I'll definately try to get the O'Reilly book :)
iDxMan
09-03-2004, 09:23 PM
As for editors, check out the `favorite editor` thread that's somewhere on this site.
jEdit (http://jedit.org) is one of my favorites along with VI and UltraEdit (http://ultraedit.com)
-r
imported_atlantis
09-04-2004, 12:27 AM
Thanks, iDxMan. I'll check out these two and look for the 'favourite editor' thread :D
sans-hubris
09-05-2004, 02:09 AM
Originally posted by atlantis
Thanks, iDxMan. I'll check out these two and look for the 'favourite editor' thread :D I would highly suggest that you stick to an OSS editor. There is verly little political influence behind this statement. It is my personal experience that OSS text editors (particularly for coding) greatly outshine the quality of their proprietary cousins. YMMV I think the reason behind this is obvious: the people these editors are targeting are coders themselves, and so if they perceive a problem or missing feature, they can go in and fix it, add it, or whatever.
VIM (Vi IMproved), Emacs and many other editors are available for Windows. Keep an eye on this (http://www.iidea.pl/~js/qkw/) page, since there is a possibility that you may yet see Kate for Windows.
imported_atlantis
09-05-2004, 09:57 AM
Thanks sans-hubris, again :D QT-KDE Wrapper sounds *very* interesting, mainly because it'll be native. Anyway, I guess I'll be working under UNIX more than Win32 for programming ;)
kryptech.net
09-05-2004, 05:54 PM
Python, just python :)
/me holds nothing against other languages as to not start a flamewar though
imported_atlantis
09-05-2004, 11:59 PM
kryptech.net, I was about to get into Python as well but I didn't because I realize most website hosts don't allow python scripting, and there were a bit too many libs to make them work on other computers. Also, I read Perl integrates better with the web. Maybe you can clarify me on this one? :) Thanks...
Whiteknight
09-06-2004, 10:20 AM
perl has oft been described as the "duct tape of the web" or "the glue that holds the internet together" and it's been doing a similar job for a very very long time. there is alot of use for python as well, but it isnt as widespread as perl on the web.
imported_atlantis
09-06-2004, 10:30 AM
Thanks for that :) I'm going with Perl, but I can always do some Python and PHP on the way much later :)
Strike
09-06-2004, 04:04 PM
Learning perl is a disservice to yourself and everyone else in the coding world, IMO. It's a wretched language.
imported_atlantis
09-07-2004, 09:07 AM
What are the reasons for these claims, Strike? :O
Strike
09-07-2004, 02:50 PM
http://www.linuxquestions.org/questions/showthread.php?s=&threadid=75692&highlight=perl+rant
read this thread, and you'll see why
Whiteknight
09-07-2004, 04:35 PM
the arguments in that first post (all i have time to read between classes) are limp at best, and many of them are irrelevant now with newer versions of perl.
1) the bit about the community is stupid. the "there's more then one way to do it" approach is very important because there isnt a single "right way" to tackle all problems, as there seems to be in python. the power of perl is in it's flexibility, and problems can be solved differently for different needs by different people. I see this as a strength.
2) the fact that an obscure community of "perl hackers" couldnt solve a simple problem (reading in all but the first line of a file) isnt an indictment of the language so much as an indictment of that community. many people flock to perl because it is quick and easy, and as such you dont see herds of heavily disciplined coders writing perl code, and solving perl problems. a community of self-proclaimed "perl hackers" who aren't disciplined programmers are bound to make mistakes. same with any language. Perl is just a tool, the programmers bring in their own level of discipline.
3) by the rules of procedural programming, long arbitrary lists of arguments to a function are bad. the fact that python allows this reeks to me of bad programming habits. OO is more strict to this point. perl may not be fully OO, but to a good, well-disciplined programmer, this shouldnt matter.
4) the differing contexts of a single variable offers a large amount of flexibility and power that other languages dont have. It offers the ability to treat an array like a scalar, and vice-versa. things like the length of an array are calculated so often, that no function is even required: you simply take the name of an array in array context, and treat it like the scalar length of the array. this is much easier then making or using a function to do the job.
5) is perl ugly? i dont think so, although there is a trade-off between raw power and readability. Good code should be well commented, especially where there is distinct need, and a good perl programmer should be familiar enough with the syntax to read any script with relative ease.
the variable prefixes are important, both for distinguishing context, and for determining at-a-glance the significance of any array or variable. this way variable names--no matter how well or poorly named--can be immediately distinguished from non-variable identifiers. the artical says it explicitly: if the perl community at large is incapable, can you trust them all to name their variables and lists appropriately? if not, then you have to accept that prefixes make this job much easier.
I've heard plenty of good arguments for and against, but as far as i'm concerned, Perl is the best choice for me, for the job it does.
kryptech.net
09-07-2004, 05:58 PM
yes, perl is a wreched language, python is not supported by web services... OMG, I had no idea... and I couldve sworn that it was... hmm actually PHP is more popular for learning now perl is fine, but pythons syntax is much easier to understand.
Strike
09-07-2004, 06:59 PM
Originally posted by Whiteknight
1) the bit about the community is stupid. the "there's more then one way to do it" approach is very important because there isnt a single "right way" to tackle all problems, as there seems to be in python. the power of perl is in it's flexibility, and problems can be solved differently for different needs by different people. I see this as a strength.
I think you fail to understand what my objections are. Yes, of course there are many ways to solve problems, and the same is true in pretty much any programming language, including Python. It's not "there's more than one way to tackle all problems" that bugs me, it's "every little bit can be done differently". Meaning I can write if statements about fifty different ways. Why bother? Pick one that works well and stick with it. It's vastly less confusing that way.
3) by the rules of procedural programming, long arbitrary lists of arguments to a function are bad. the fact that python allows this reeks to me of bad programming habits. OO is more strict to this point. perl may not be fully OO, but to a good, well-disciplined programmer, this shouldnt matter.
What rules? And what bad programming habits? I already said that you don't generally need such things. But if you do need them, it's nice to have a sensible way of defining it all. Perl doesn't offer that.
4) the differing contexts of a single variable offers a large amount of flexibility and power that other languages dont have. It offers the ability to treat an array like a scalar, and vice-versa. things like the length of an array are calculated so often, that no function is even required: you simply take the name of an array in array context, and treat it like the scalar length of the array. this is much easier then making or using a function to do the job.
The fact of the matter is that the stupid context-switching that goes on behind the scenes is more confusing than just calling a function on an array to find the length of it. You don't save anything. It's much more obvious to see:
len(some_list)
than:
scalar(%some_array);
and guess what's going on in each.
Pretty much everything else you've presented was already rebutted in that thread anyway.
Whiteknight
09-08-2004, 09:24 AM
haha, yeah i didnt have enough time to read the rest of that thread, like i had wanted to. I dont have reliable internet access here, so some things get shuffled down to the bottom of my pile.
What I like most about perl, and what i use it for most often, is jsut writting quick and dirty scripts to tackle problems that would require alot more work in another language, like C or java. I can throw together an ugly little script to solve a problem when i need it solved, and then go back later and make it all "better" in a manner of speaking. in this aspect it works alot like a natural spoken language, because you can use slang and shorthand to get your point across. some people need more structure then that, and thats certainly respectable too.
imported_atlantis
09-08-2004, 11:37 AM
Wow, thanks all for your input :D It's certainly made it more difficult to decide. I like the views presented by both sides ;)
But a third contender enters, PHP. I'm confused again so I added that to the list :P
zachogden
09-08-2004, 03:42 PM
Ad addendum:
What does PHP stand for?
Strike
09-08-2004, 05:13 PM
It used to stand for "Personal Home Page" but now I think it's a recursive acronym: "PHP Hypertext Processor" (though that may have changed too)
imported_atlantis
09-08-2004, 10:46 PM
The latter's what I read in a tutorial, which made me wonder how recursive acronyms may be the one weapon make people go mad expanding!! :P lol
vBulletin® v3.7.0, Copyright ©2000-2010, Jelsoft Enterprises Ltd.