Thread: breaking the java habit...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    Omaha, Nebraska
    Posts
    116

    breaking the java habit...

    so i was reading one of the threads that started quite a debate.
    link's right here.
    I found it pretty interesting, both the forum and the authors of the discussed article made some really excellent points, but it brought up some questions for me.
    Mainly how does some one whose first programming language was Java break the Java habits?
    They don't work for C and C++ (obviously ) but I can't seem to get passed going back to Java to try to figure out how to write C code.

    At any rate, I was hoping to get some feed back from you guys and gals.
    Thanks again!

    ~M.I.

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    I'm coming from a non-C / non-C++ background as well. I too find myself "all the time" working out the code I'm trying to write in the language I primarily code in. So, it's not just Java!! I've been coding in Assembler for 18 years!

    I feel your pain.

    Todd

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Breaking a paradigm habit is the same as breaking any other habit. Prevent yourself from indulging in it. Arrange things so that you get negative feedback every time you indulge. (E.g. to get rid of finger biting, paint your nails with this foul-tasting stuff.)

    Learn Haskell or ML. The functional approach is so fundamentally different that with an imperative, object-oriented mindset you will get absolutely nowhere. That ought to work.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    I hopped from regular Java study and use to heavy C++ use. One step is not to read material the compares how the two languages do things, because it seems as though they get you thinking, "In java you do this, but like this"

    I don't think it's so difficult, because other than the whole library and that stuff you just have to know the basics.

    I'm taking a class where we're doing ml this semester, wish me luck.

  5. #5
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quit java like you quit cigarettes, by going cold turkey.

    Don't buy cigarettes, dont use java. Eventually the effects will wear off.

  6. #6
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    And don't think C# is a nicorette patch.

  7. #7
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Ultimately you need to realize that the assertion that Java is 'just like C/++' is a load of malarky. See C/C++ as a new language and you will overcome one of the largest mental barriers to learning C/C++. Whether its true or not is irrelevant. Seeing them as 'similar' makes you end up using your java knowledge to try to figure out C/C++, which ultimately holds you back. Its unfortunate that you where mentally abused by being taught java as a first language, so radical steps are necessary to fix the damage.

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    See C/C++ as a new language and you will overcome one of the largest mental barriers to learning C/C++.
    I agree. I would extend this to C and C++ as well, in that recognising that they are different and not some language named C/C++ is a step across the barrier to learning one after learning the other.

    Its unfortunate that you where mentally abused by being taught java as a first language, so radical steps are necessary to fix the damage.
    I think that is an exaggeration. It not mental abuse to be taught programming with Java as the first programming language. The "radical" steps we're talking about here is necessary when learning any new programming language radically different from the ones you already know.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    I'm noticing a trend with abachler

  10. #10
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by indigo0086 View Post
    I'm noticing a trend with abachler
    Heh, what trend would that be?

  11. #11
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Mainly how does some one whose first programming
    >language was Java break the Java habits?
    Why would you want to? At the risk of alienating all of the language zealots here, you learned Java, and those lessons are valuable. There's no reason to throw them away, even if you move to a different language. Just remember that Java is Java, and other languages are not Java. Adjust your habits accordingly, but don't discard them.
    My best code is written with the delete key.

  12. #12
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Java is a language for babies :duck:...

    j/k. Although I dont see it as being useful outside web applications.

  13. #13
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    I like Java. It looks good on my resume.

  14. #14
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by Prelude View Post
    you learned Java, and those lessons are valuable. There's no reason to throw them away, even if you move to a different language. Just remember that Java is Java, and other languages are not Java. Adjust your habits accordingly, but don't discard them.
    True, but I think the adjusting is what the OP has problems with. And the best way of stopping to try to apply the Java way of thinking to everything is to completely avoid the Java way of thinking for a time. It's not like you forget it.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  15. #15
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    One thing that helps is to program in several different languages at the same time (but not necessarily for the same project). Since I've had to do that I found I think more about the problem, possible algorithms, restrictions, etc long before an implementation comes to mind. I then start thinking about the implementation (in generics) which then leads me to a language and then to a specific method.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C#, Java, C++
    By incognito in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 10-05-2004, 02:06 PM
  2. The Java language is being expanded
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 06-11-2004, 09:07 PM
  3. Java woes
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 07-06-2003, 12:37 AM
  4. C or Java as a first language
    By CorJava in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 10-23-2002, 05:12 PM
  5. Visual J#
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-08-2001, 02:41 PM