Help - Search - Members - Calendar
Full Version: Java as a first programming language?
Hydrogenaudio Forums > Misc. > Off-Topic
QuantumKnot
When I went to college, the languages I learnt were C, then C++, and then Java. It seems like a logical progressions, learning the basics of procedural programming, then moving to the object-oriented paradigm in a "familiar" language (knowing C and doing C++ is like an extention). Then Java was like a more pure form of OO language that shared some syntax with C++.

But it seems to be the trend nowadays in Information technology and computing science (even some engineering courses) that the very first language taught to students, some who had never sat in front of a computer, is Java.

Personally I believe Java is not suitable as a first teaching language. It is too cumbersome to do really simple stuff that are designed to teach fundamental concepts. Setting up an applet just to read a string and print it out involves considerably more work, typing effort and understanding, than it is to write it in C or C++. Some students get repelled by this verboseness and think all programming languages are as cumbersome as Java, yet this is perhaps a bad misconception.

What do you think?
Gabriel
I think that if you want your students to learn C++, you should not teach them C before. If they consider C++ as a C extension, it is likely that the result will be very C-ish, and not proper OO C++.

Sure, they need a first langiage to learn the basics of programmation. This could be old Pascal or even pure algorithmic.
mp3chan
That's true, in my college the first programming language is java. The worse thing happen because some student have never learnt how to program at all. They don't know what to type and finally type very strange code because they think that java is very smart programming language and will correct some small mistakes. The most common problem in my class is after they put System.out.print("input a number: "); they never store the input number in a variable.

I think without programming background, students should learn algorithm first, and may be some flow diagram as well... so that it easier to translate algorithm to programming syntax.
Florian
IMO a modern scripting language like Python combines the need for teaching programming fundamentals first and bridges easily to the concepts of object-oriented programming.

~ Florian
sthayashi
If I may divert the topic a bit, I have a question for the programming crowd. One of the things I would like to do in the future is learn to develop programs and applications like foobar/Ogg Vorbis/MPC/Etc... But here's the kicker. I learned to program in C++ while I was in college, but I've quickly found out that academic programming is quite a bit different than general application programming.

Does anyone have any suggestions at what I should do to learn how to write program applications and what not? This is a case where I'm dying to contribute something to this community, but I don't have the skills to do so. How do I get the skills?

Thanks.
fewtch
QUOTE(Gabriel @ Nov 12 2003, 04:56 AM)
Sure, they need a first langiage to learn the basics of programmation. This could be old Pascal or even pure algorithmic.

It could have been Visual Basic, at least up to version 6. Actually, the old DOS QuickBASIC is a good first language to learn the basics, in my opinion -- provided it's taught properly with attention to good techniques. Much smoother learning curve than straight C (text mode or not). From there to VB, then to C++ ought to be a pretty smooth transition, at least for those wanting to program Windows apps.
KikeG
QUOTE(sthayashi @ Nov 12 2003, 03:02 PM)
How do I get the skills?

Practicing, learning the specific techniques of what you want to do, including looking at source code examples and actual implementation, and more practicing, I'd say.
fewtch
QUOTE(KikeG @ Nov 12 2003, 07:59 AM)
QUOTE(sthayashi @ Nov 12 2003, 03:02 PM)
How do I get the skills?

Mostly learning the specific tecniques of what you want to do, including looking at source code, and a lot of practicing, I'd say.

Yep, like a "regular" language (for communication) -- requires a lot of actual use in real world situations. Starting with simple utilities is a good way... stuff you can use yourself like a small .wav or midi player, hard drive or CD-R catalog utility, mini dictionary or calculator, stuff like that. Try to reinvent the wheel often, so you learn how wheels are made... wink.gif
rohangc
QUOTE(Gabriel @ Nov 11 2003, 11:56 PM)
I think that if you want your students to learn C++, you should not teach them C before. If they consider C++ as a C extension, it is likely that the result will be very C-ish, and not proper OO C++.

Sure, they need a first langiage to learn the basics of programmation. This could be old Pascal or even pure algorithmic.

Gabriel, I spent 2 years teaching myself C so that I could learn C++ properly one day. Is there no hope for me? Can I never write proper C++ code? sad.gif
tangent
Heh, in engineering course, Fortran was the first language taught, but Java was just being phased in to replace Fortran. C was introduced next, and I think that's the best language for engineering purposes.

I agree that algoritimns is more important, and the language doesn't really matter. A good programmer should be able to handle any new language really quickly.
Continuum
QUOTE(tangent @ Nov 12 2003, 07:40 PM)
Fortran was the first language taught, but Java was just being phased in to replace Fortran.

Ha, it's the same here! Fortran, go! rolleyes.gif
eloj
QUOTE(rohangc @ Nov 12 2003, 06:08 PM)
Gabriel, I spent 2 years teaching myself C so that I could learn C++ properly one day. Is there no hope for me? Can I never write proper C++ code?  sad.gif

Sure you can, you'll just have to forget 22 of those 24 months with C. :-)

See the FAQ. If you're serious about learning c++ I suggest you take a look at the In Depth-series mentioned.
schnofler
QUOTE(tangent)
I agree that algoritimns is more important, and the language doesn't really matter. A good programmer should be able to handle any new language really quickly.

That might be true as long as you're talking about strictly procedural languages, or generally about the same kind of languages. Sure, if you know one procedural language reasonably well, you can learn others relatively quickly. But this is not at all true for switching to an OO language like Java.
Learning how to program well with OO really needs a lot of practice. And here, the language does indeed matter. Sure, if you're only going to write relatively small or computation centered programs, you need to know the right algorithms and then you can use about any language (well, "normal" languages at least; you won't have much fun writing an mp3 decoder in Prolog or something).
But if you want to write large applications, clean design becomes much more important. And here an OO language can make an enormous difference.
So, to stay on topic for a moment, Java might not be the best beginner language (you really need to know some things about OO programming before you can even start writing very simple programs). But I think after having learned the basics in some simple procedural language, switching to OO soon (and that doesn't really need to be Java) might be a good idea. I wouldn't recommend C as a beginner language, though, and even less C++. These languages are of course very powerful but you can write really bad programs in C much easier than in many other languages. And it might be even worse with C++, because you can start mixing procedural and OO design in funny ways. I'm not at all opposed to C or C++ in general. If you know how to use them, you can write programs just as clean as in any other language, and of course C and C++ have some advantages that few other languages can compete with (they're extremely widespread and when it comes to raw speed, well, Java just won't do the trick).
QuantumKnot
QUOTE(rohangc @ Nov 13 2003, 03:08 AM)
QUOTE(Gabriel @ Nov 11 2003, 11:56 PM)
I think that if you want your students to learn C++, you should not teach them C before. If they consider C++ as a C extension, it is likely that the result will be very C-ish, and not proper OO C++.

Sure, they need a first langiage to learn the basics of programmation. This could be old Pascal or even pure algorithmic.

Gabriel, I spent 2 years teaching myself C so that I could learn C++ properly one day. Is there no hope for me? Can I never write proper C++ code? sad.gif

I dont believe so. I started off learning C and later picked up C++ where I immersed myself in the OO world. biggrin.gif The key thing is to realise the intricacies and novelties of using classes. After a bit of practice, you'll be writting OO programs and start to forget procedural. It took me a while to get back to writing a functions-based program when my brain is so used to break up a program into classes. smile.gif C gives you knowledge of the syntax. Plus, the only particular attribute of C-ish programming that I can think of at the top of my head is the use of printf's, scanf's, rather than cout and cin. I've talked to a few C++ programmers and they all think printf is evil. laugh.gif
DonP
QUOTE(Continuum @ Nov 12 2003, 12:55 PM)

Ha, it's the same here! Fortran, go! rolleyes.gif

At my last job we were wholesale replacing Fortran programs because the Fortran compiler for IBM unix (AIX) was End-of-Life'd.
phong
My recommendation: learn something cool like Python or Ruby. They're nice, but it really doesn't matter what languages you learn as long as you don't get stuck in one mode of thinking or get over-comitted to something really crappy. If you do any significant amount of programming, you'll eventually be picking up C/C++ eventually anyway, so no rush there. Java is bloated and annoying, but passable and was the beneficiary of some really outsanding marketing, so there'll probably always be jobs in that (I imagine the hype will wear off when the next hot thing comes along though - probably C# for a while, then something else).

I'll just rant about programming languages in general and hope nobody notices...

My first language was BASICA then Apple II basic and I eventually learned how to write quality procedural code in Pascal and C (with no GOTOs). Then there's more GOTO stuff in x86 assembly (and a little Apple II and 680x0 asm too). Then I think there was some stuff with Visual Basic which I've repressed. Later, there was object oriented stuff in C++ and Java and functional code in Scheme. Then more GOTO stuff in Fortran and COBOL (again, repressing.) Then there was Perl and PHP and Cold Fusion (yes, pity me), and Tcl and all these lovely scripty things playing host to SQL queries. Nowadays it's Python (ooooh... sweet... delicious Python...) and I just do What Works Best™ for the job at hand.

Imperitive, procedural, functional, logical, object oriented, aspect oriented... Bah, whatever. I don't think it matters as much as people think. I suppose if you really want to learn a new paradigm properly, it's probably best to go about it from the point of view of "learning to program again for the first time". But it's actually not that hard. Most concepts carry over to all paradigms (boolean logic, variables, assignment, collections of data, etc.) Class/object methods are really just glorified functions/procedures. Query/logical languages are definately a hard switch (most people write profoundly terrible SQL and design horrifying database schemas), but the others aren't.

The fundamental difference between every programming paradigm is the way the language hides the GOTOs from the programmer. That's about it.

QUOTE(rohangc)
Gabriel, I spent 2 years teaching myself C so that I could learn C++ properly one day. Is there no hope for me? Can I never write proper C++ code?

Nah, don't worry about it. Well, you might never write proper OO C++ code, but you'll be able to blame it on the fact C++ sucks. C++ is to OO as VB is to dynamic typing. Crummy examples of their breed.

QUOTE(tangent)
I agree that algoritimns is more important, and the language doesn't really matter. A good programmer should be able to handle any new language really quickly.

Agreed, but I see algorithms becoming less significant. Most people don't have a need to learn how to write a quicksort or a hash table, because those things are built into modern very-high-level-languages. More complex things (i.e. data compression) are usually used via some popular library. Most commonly used time-consuming algorithms are "solved problems." Sure, somebody's gotta write the languages and libraries, but most code these days seems to be devoted to two primary tasks:

1. Interacting with users
2. Moving data around

VHLLs are great at #2, especially query languages like SQL which are devoted entirely to that task. No languages are very good at #1, but some are useable (the one thing VB works decently for). It seems like there should be three things... Oh yeah, these three. Anyhow, I see the future of software development moving towards having those two or three layers which will be almost completely separate from each other and written by different people in very different languages.
niktheblak
QUOTE(rohangc @ Nov 12 2003, 08:08 PM)
Gabriel, I spent 2 years teaching myself C so that I could learn C++ properly one day. Is there no hope for me? Can I never write proper C++ code?  sad.gif

Do you want to?

Are you thinking in "classes"? If you encounter a programming challenge, do you instantly think what kind of class you should use, what are the data members and what kind of member functions the class needs? Do subclass hierarchies form into your brain almost automatically? Interfaces? If you answered "yes" in any question, you have plenty of hope.

Hmm, if Java isn't suitable for a first programming language, it isn't suitable for anything at all.

@phong

Based on your signature and avatar, do you think Star Control II is the best game ever written, or merely the second best? I vote for best B)
robert
I had to learn SCHEME--a Lisp dialect--in my first semester at college. The reason why it was SCHEME was, almost no first semester students were familiar with this language. (btw Lisp is a functional programming language; beside the fact that you always forget at least one closing brace, the language is quite cool.)
ErikS
QUOTE(robert @ Nov 14 2003, 02:54 AM)
I had to learn SCHEME--a Lisp dialect--in my first semester at college. The reason why it was SCHEME was, almost no first semester students were familiar with this language. (btw Lisp is a functional programming language; beside the fact that you always forget at least one closing brace, the language is quite cool.)

Ditto. But the language was Haskell for me. I agree that it's a good idea to let everybody start equally. Those who had done lots of imperative/OO programming before were even at a slight disadvantage for this course because of their way of "thinking" imperatively with vairables, assignments etc... Also the lazy evaluation played funny tricks with them when they tried to "optimize" code smile.gif Cool but utterly useless language for anything but research... Anyway, it was an interesting experience.
Mac
I would agree with the idea of learning Python, or personally I would say PHP first. Some of the syntax and structure is similar to C, so that when you step into C you aren't at all surprised by how some parts work. PHP is also a hell of a lot 'friendlier', you can mess up all over the place and still get working code out smile.gif
Florian
QUOTE(Mac @ Nov 14 2003, 11:58 AM)
I would agree with the idea of learning Python, or personally I would say PHP first.

You're right PHP also teaches basic programming concepts very well, but IMHO the step to OOish programming and thinking is easier with an OO scripting language like python is.

~ Florian
phong
I'm not quite as enthused about PHP. I consider it a "special purpose" language that is very good at it's primary purpose - web apps, but isn't ideal for "general programming".

If you're looking to learn something with C-like syntax (algol derived languages), there's no shortage... Java, Perl, PHP, C/C++ are the most popular, but there's hundreds of others... Objective C I've heard is nice but I haven't tried it. Pike looks interesting.

I believe there is a very good argument for learning a low-level-language first (and here I'm talking C, which is the only LLL worth learning for most people.) It lets you understand how things really work and will dramatically improve the quality of code you write in HLLs; e.g. you'll understand what the stack is, how memory allocation works, why working with strings is complicated (and potentially very slow), how pointers and memory addressing work, why threading is complicated, the utter evil of returning "error codes", etc.

Then you can jump to a nice HLL and not have to worry so much about those things (while their presence in the back of your mind keeps you on the straight and narrow). Pointers are replaced by references, threading is still tricky, but not hairy, free/malloc make way for garbage collectors, static typing is replaced by dynamic, return codes are replaced by exceptions, etc. Then you can learn about the really fun stuff - closures, objects, higher-order functions, dynamic code generation...

QUOTE(niktheblak)
Based on your signature and avatar, do you think Star Control II is the best game ever written, or merely the second best? I vote for best

Best, but a qualified best. But that's the subject for another thread... (BTW: I just got www.fwiffo.com, though the DNS stuff may not have propogated through everywhere yet.)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.