I want to learn a programming language

Programming languages, Coding, executables, and scripting.
Message
Author
User avatar
Gomer_X
Posts: 201
Joined: 2008-04-11 15:06
Location: Cincinnati, OH, USA

#21 Post by Gomer_X »

IronRage wrote:Does Perl make it easier to learn C or C++?
In my experience, yes (for C, at least).

Perl is designed for doing something quickly without the trouble of writing it in C (and when you need more power than a shell script can handle). It allows you to get something working quickly, so you get instant gratification.

Perl is forgiving of sloppy syntax (but can be strict if you want) and lets you do things a number of ways and get the same results.

It CAN make it easier to learn bad habits that you may have to unlearn later when you get to a more structured language.

Python has many of the advantages of Perl, but not all the disadvantages. Unfortunately no matter how I try, Python just doesn't make sense to me. :D

User avatar
Vultaire
Posts: 51
Joined: 2007-07-05 04:59

#22 Post by Vultaire »

I'm not gonna try to start a Python vs. Perl flame war. I've used both, and I do prefer Python, but that aside, both languages are good gateways to C/C++ and other "harder" languages.

Perl, it's true, has a reputation for write-only code. However, there is well-written perl code out there as well. It depends on the programmer using the tool, like with anything.

Python tends, IMHO, to have a cleaner syntax, although the enforced indenting drives some people up the wall, as does the "this" pointer being required in member function declarations. I think these are minor annoyances, but it's your call.

Here's a few good resources for both languages. For Perl, check out Beginning Perl. It's a very good free book on the language. Alternatively, for Python you can check out Dive Into Python. It should also be available in the Debian repos.

User avatar
Telemachus
Posts: 4677
Joined: 2006-12-25 15:53

#23 Post by Telemachus »

Vultaire wrote:Here's a few good resources for both languages. For Perl, check out Beginning Perl. It's a very good free book on the language. Alternatively, for Python you can check out Dive Into Python. It should also be available in the Debian repos.
The Simon Cozens book on Perl is great, but "Dive Into Python is a Python book for experienced programmers." So I'm not sure that's the best book for this situation.
"We have not been faced with the need to satisfy someone else's requirements, and for this freedom we are grateful."
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System

User avatar
Vultaire
Posts: 51
Joined: 2007-07-05 04:59

#24 Post by Vultaire »

Bleh, good point. I was just thinking about what I used as my reference for getting started. I stand corrected. :)

rusi_pathan
Posts: 5
Joined: 2007-11-07 00:47

Re: I want to learn a programming language

#25 Post by rusi_pathan »

KOTAPAKA wrote:I am going to uni in October to do and engineering degree and I have the whole summer now. So I was thinking of learning a new programming language. I don't know what language to learn though. I have some suggestions but they might be completely inadequate. Here they go:
C
Perl
Lisp
Python
FORTRAN

As far as I know FORTRAN is used in computational programming. I don't know much about the others. I tried reading wikipedia but it explains it with terms I don't know. Anyway, I need to make an important decision. I have approximately 3 months with perhaps several hours a day. I will most likely learn several of those but I don't want to learn something which is not used anymore. I also want to do this so that I will be able to write scripts and understand Linux/Unix configuration files better.

PS please feel free to add any other language you think is more appropriate than the ones listed above. As I said I am completely new to programming.
Which engineering are you doing?

If it is Comp Sc/EE then you must learn C and perhaps C++. However do remember that it can take you years to master C++.

If it is Aero/Mech/Civil/Physics and if you expect to do heavy numerical computing (CFD/Solid mechanics etc.) then you should learn Fortran (not FORTRAN). Fortran 90/95/03 has matlab like syntax and modern compilers can often auto parallelize good parts of the code.

Python/Ruby are very nice scripting languages but I would suggest that you learn them only after you've done C/C++/Fortran (as they are easy to learn and you can be productive fairly quickly)

One thing I would suggest is that you stick to one language for the first few months and only then move on to others (if needed). Looking at 5 different languages at the same time will only lead to confusion/frustration.

Good luck.

User avatar
Gomer_X
Posts: 201
Joined: 2008-04-11 15:06
Location: Cincinnati, OH, USA

#26 Post by Gomer_X »

Vultaire wrote:Here's a few good resources for both languages. For Perl, check out Beginning Perl. It's a very good free book on the language. Alternatively, for Python you can check out Dive Into Python. It should also be available in the Debian repos.
I never got a grasp on Perl (even after reading "Learning Perl," the O'Reilly book) until I worked through a tutorial called "Robert's Perl Tutorial." The Google will find it. The original is long gone, but it's mirrored many places. Short, humorous and easy to follow.

For Python, there's a book called "How to Think Like a Computer Scientist" that is designed to teach beginning programming using Python. I've heard it is excellent. It can be found here: http://www.openbookproject.net/pybiblio/books/

User avatar
Telemachus
Posts: 4677
Joined: 2006-12-25 15:53

#27 Post by Telemachus »

Gomer_X wrote:I never got a grasp on Perl (even after reading "Learning Perl," the O'Reilly book) until I worked through a tutorial called "Robert's Perl Tutorial."
Fair enough, but I would be reluctant to recommend a tutorial where "the last hack was made on 20th April 1999." Perl has changed a lot since then. That said, the Google did find it (in many places), and here it is.
"We have not been faced with the need to satisfy someone else's requirements, and for this freedom we are grateful."
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System

User avatar
Gomer_X
Posts: 201
Joined: 2008-04-11 15:06
Location: Cincinnati, OH, USA

#28 Post by Gomer_X »

Telemachus wrote:Fair enough, but I would be reluctant to recommend a tutorial where "the last hack was made on 20th April 1999." Perl has changed a lot since then. That said, the Google did find it (in many places), and here it is.
It's not a complete text on learning Perl, it's just a short tutorial. I didn't find anything in it out of date. It's definitely incomplete, but it got me hooked enough to move on to more in depth references.

If you want the works, get the latest Camel book (although that's outdated with Perl 5.10 out [edit: it was actually printed in 2000 and current as of Perl 5.6]).

User avatar
KOTAPAKA
Posts: 507
Joined: 2008-02-22 00:26
Location: UK

#29 Post by KOTAPAKA »

Well what I have planned is to read the Algorithms and Data Structures - Niklaus Wirth and do Python parallel with that. I'll see what happens. I'll try Fortran as well but later on.
Debian Lenny "stable"

User avatar
Gomer_X
Posts: 201
Joined: 2008-04-11 15:06
Location: Cincinnati, OH, USA

#30 Post by Gomer_X »

KOTAPAKA wrote:Well what I have planned is to read the Algorithms and Data Structures - Niklaus Wirth and do Python parallel with that. I'll see what happens. I'll try Fortran as well but later on.
Good plan. Python is an excellent starting language.

I'm not sure why you'd want to learn FORTRAN unless you really need it for engineering applications or something. I found it a lot like BASIC with some of the ugliness of BASH script thrown in. :)

rusi_pathan
Posts: 5
Joined: 2007-11-07 00:47

#31 Post by rusi_pathan »

Gomer_X wrote:I'm not sure why you'd want to learn FORTRAN unless you really need it for engineering applications or something. I found it a lot like BASIC with some of the ugliness of BASH script thrown in. :)
FORTRAN (77) sure is ugly and a PITA. But Fortran (90/95/2003) is much simpler, elegant and more powerful.

I actually find it easier to use than Python/MATLAB (for numerical stuff). Plus the code runs anywhere from 2-100x faster. Heck the compilers can even auto parallelize parts of it to utilize those extra cores.

User avatar
garrincha
Posts: 2340
Joined: 2006-06-02 16:38

#32 Post by garrincha »

rusi_pathan wrote: FORTRAN (77) sure is ugly and a PITA.
I actually had to use a little bit of FORTRAN 77 in the early 1990s, but mostly I was working on a variant of FORTRAN called Advanced Continuous Simulation Language (ACSL) which is useful for some of the machines that are described as time-dependent, non-linear model. Now don't ask me what was the critical difference between the two programming languages because it has been over 10 years since I last dabbled in this type of programming and I'm rather rusty in differential calculus! :lol:
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

GODhack
Posts: 50
Joined: 2008-05-23 18:33

#33 Post by GODhack »

Image
1956 :!: Learn how to make holes :D

GODhack
Posts: 50
Joined: 2008-05-23 18:33

#34 Post by GODhack »

Vultaire wrote: Perl, it's true, has a reputation for write-only code.
If it was hard to write, it should be hard to understand!
One-liners are so sexy:
http://www.theperlreview.com/Articles/v ... liners.pdf
http://sial.org/howto/perl/one-liner/
http://linuxgazette.net/issue84/okopnik.html
:P
You can even download youtube video with Perl one liner.

Code: Select all

perl -MWWW::Mechanize -e '$_ = shift; s#http://|www\.|youtube\.com/|watch\?|v=|##g; $m = WWW::Mechanize->new; ($t = $m->get("http://www.youtube.com/v/$_")->request->uri) =~ s/.*&t=(.+)/$1/; $m->get("http://www.youtube.com/get_video?video_id=$_&t=$t", ":content_file" => "$_.flv")'

Epimetheus
Posts: 20
Joined: 2008-07-12 20:43

#35 Post by Epimetheus »

It all depends.

For learning a programming lanaguage you could also try Java; there is an abundance of resources (and library/class inheritance) information out there including whole tutorial samples... So far whenever I didn't quite know what to write in order to make xyz happen, with Java I always had the least trouble finding some article describing some solution, and then adapting it to my needs.

Another definite go (as in easy to learn yet powerful to use) is PHP. Haven't yet used Python or Perl (should pick those up sometime in the future). What I like about PHP that you can mix & match typical OOP with other styles (I hear that's what's great about Python also). Python seems to enjoy wide support for writing your own extension to other apps (Gimp, 3d modelling tools, GIS software...); PHP & Java are very similar to C (you'll have little trouble understanding some C code if you know either of those).

Anyway there is another language which you should've seen and is immensely powerful for writing very simple & readable code: Haskell. Lazy evaluation, no (or at least fewer) restrictions on the size of data-structures (truly loooooooonnnnggggg integers, much better floating point accuracy!), and oh so beautifull to read. It's an art. It requires you to think a lot but write relatively little; thinking your algorithms through really pays off (or conversely: not doing so, and specifically ignoring compile time warning will lead to considerably lesser performance at run time). However the lazy evaluation makes it possible to operate on data structures which are (theoretically) of infinite size!

User avatar
drl
Posts: 434
Joined: 2006-09-20 02:27
Location: Saint Paul, Minnesota, USA

#36 Post by drl »

Hi.

In an article in the July 2008 of IEEE Computer abstract hereargues for a scripting language as the first language, notably ruby or python, as opposed to Java, which is currently a favorite in many college courses. The choice is made on the basis of pragmatics:
addressing more abstract social and cognitive functions of languages, situations, speakers and hearers, discourse, goals and uses, and performance
Regrettably, the article itself is not available on-line unless you are a member or subscriber.

Best wishes ... cheers, drl
["Sure, I can help you with that." -- USBank voice recognition system.
( Mn, 2.6.x, AMD-64 3000+, ASUS A8V Deluxe, 3 GB, SATA + IDE, NV34 )
Debian Wiki | Packages | Backports | Netinstall

danieldk
Posts: 151
Joined: 2004-10-05 12:02
Location: Groningen, The Netherlands

#37 Post by danieldk »

As some people have pointed out, the key point is to learn programming, not a language. This consists of learning how to convert problems to data structures and algorithms, and learning how to implement structures and algorithms in a language. Then there are many related facets, such as learning programming paradigms (e.g. OOP, functional programming, logic programming) and common things that all languages share (types, etc.).

I often advise people to start with Java. It may not be the most popular language on Unix platforms, but for learning programming it has a lot going for it:

- It uses the OOP paradigm, which is currently the most popular paradigm for general purpose applications.
- It's a safe language: common classes of errors will lead to exceptions, rather than undefined behavior (such as often the case in C/C++).
- It has static typing. Learning about types and relations between types (promotions, etc.) is important, and the explicit typing of static languages helps with this.
- It's a simple language. Arguably, generics have damaged this facet a bit, but it's still a very simple and predictable language.
- It has predictable references. In the Java world, references are comparable to pointers, sans pointer arithmetic (and automatic dereferencing). This means that you'll learn about how you can point to object instances, and use this to optimize algorithms, without falling into the trap of wild pointers, etc.

Or in summary: Java has nearly all the concept that you'd have to learn for an OO language, while protecting very well against the traps that could divert you from the main goal: learning to program.

After Java, I'd go for C/C++ and some scripting language such as Python.

danieldk
Posts: 151
Joined: 2004-10-05 12:02
Location: Groningen, The Netherlands

#38 Post by danieldk »

IronRage wrote:Seriously though, go with C or C++.
What, do you really want a newcomer to deal with 'the most vexing' parse, object slicing, etc? While C++ is my preferred 'compiled language', it's really better to start with C++ when you master most important programming concepts, have a good teacher (or book), and the time to master it.

lotr
Posts: 50
Joined: 2008-03-01 12:15

#39 Post by lotr »

JAVA best choice for me.

User avatar
s3a
Posts: 816
Joined: 2008-07-17 22:13

#40 Post by s3a »

I think Python is the easiest so you can be very productive with it.

Locked