Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

C or Java?

  1. Apr 1, 2006 #1
    Would the knowledge of C or Java be more important to software engineers? I know that most software engineers would know both languages, but which do you think would be more important to know.
    And which one do you think would be more important to an electrical engineer?
     
  2. jcsd
  3. Apr 1, 2006 #2

    dduardo

    User Avatar
    Staff Emeritus

    A good scripting language would be sufficient for an electrical engineer.

    For a software engineer it really depends on what type of development you want to do. Most desktop software is still written in C/C++. Operating systems are in C/C++. Game development is C/C++. Java is popular in the enterprise, web services, etc.

    If you go with C/C++ you'll definitely learn more about computer architecture in terms of memory allocation, addressing, low level operations, hardware interfacing, etc. Java tends to shield people from this type of stuff.
     
  4. Apr 1, 2006 #3
    I definetely want to learn about these things.
     
  5. Apr 1, 2006 #4

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    If you can only learn one language, learn C/C++. It's essentially the lowest-common-denominator of languages. Everyone knows it, and you can use it on almost any project.

    However, it's not the best language to start with. You will be better off if you begin with a high-level language like Python, then move to a lower-level language like C when your skills are more developed.

    - Warren
     
  6. Apr 1, 2006 #5
    Well, I know a little bit of Liberty Basic. I have written one very simple program that solves the pythagorean theorum for any one angle or side if you give it known values of any two sides, or any two angles, or any one side and any one angle. This program is the only program I have ever written, and everything I wrote it with is everyting I know.
    Would you like to see the program, and maybee you could see if I would be ready to jump into C and just skip Java.

    For my degree I either have to learn C or Java.
     
  7. Apr 2, 2006 #6

    -Job-

    User Avatar
    Science Advisor

    You'll probably end up knowing both if you're a Computer Science Major. Java is a more organized language than C IMO, and is very well documented (http://java.sun.com/j2se/1.5.0/docs/api/). C is good for low level stuff where you want to squeeze out the best performance, but JAVA is a very clean, modular, language and, once you know it, it will probably be your favorite language because of how well designed it is. I can't say the same for C, last week i had to code a web server & client using C, it would have been extremely easy in JAVA, but was 10x as hard with C. When it comes down to it JAVA is much easier than C. On the other hand, if i were to pick being a pro at JAVA or a pro at C, i would pick C because if you really know it well, then you're a very capable programmer.
     
    Last edited: Apr 2, 2006
  8. Apr 2, 2006 #7

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    On the other hand, Java has loads of unnecessary syntactical "salt," lends itself to rather bloated code, and is not really that much "easier" than C. Python is my language of choice for newbies.

    - Warren
     
  9. Apr 2, 2006 #8

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Not really. One of my friends made a great comment on this:

    "The only reason java is considered a high-level language is because of its extensive standard libraries."

    The language itself is more or less just C++ but with a lot of features removed.
     
  10. Apr 2, 2006 #9

    -Job-

    User Avatar
    Science Advisor

    Modularity and good coding practices are not exactly "necessary" either, but they help you alot in complex projects especially when working with groups. The "salt" you mentioned works in this direction. In my opinion, Java is the easiest language.

    Java is as high-level as it gets, i can't imagine a more high-level language than Java, it would have to be some natural language. You don't have to like Java but it's hard to argue that it isn't the most rigorous and clean language there is, but if you disagree put forward your reasons.
     
    Last edited: Apr 2, 2006
  11. Apr 3, 2006 #10
    God, I hate Java.... I wrote a web app for my Abstract algebra class that does modular arithmetic and will draw chords of circles, with each chord connecting an initial value and its modular counterpart (coordinates around the circle)

    It was my first java project and I took it up because our prof had us had drawing a bunch of circles for a project thingy.... (gug.. that was a lot of work in and of itself)

    anyway... the language seemed more like a kluge to me than anything... It seemed more like you wrote classes that magically worked together than writing a program.

    here is a link if you want to play with it:
    http://acs.madonna.edu/~110236/ModCirc/ModCirc.html

    I never got back around to actually drawing numbers to correspond to the coordinates on the circle in order to add any meaning... but it makes some pretty pictures :-)
     
  12. Apr 3, 2006 #11

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Well, Java's certainly not a kludgy language... if anything, it's much too strict, and requires too much framework code.

    - Warren
     
  13. Apr 3, 2006 #12
    I personally use C/C++. I like it becouse it's fast and it's really great for low-level stuff. But if you want too do something with graphics and soo on it's qouit ugley. For larger projects I prefer using Dolphin Smalltalk. It's not really in (donm't belive it ever was either), but for duing large things it's great (aldo it's hard to learne for a beginner).
     
  14. Apr 3, 2006 #13
    well,

    inelegantI would say that the framework problem fits the second definition of kludge perfectly. Java is certainly ineligant.
     
  15. Apr 3, 2006 #14
    Objective-C has been said to be great for gfx applications as well... it inherits its object-oriented nature from smalltalk.
     
  16. Apr 10, 2006 #15
    I learned both as an EE. I've only used C++ so far outside of my programming classes, however.

    I spend most of my time programming stuff in MATLAB.
     
  17. Apr 10, 2006 #16

    -Job-

    User Avatar
    Science Advisor

    Inelegant, Java? I couldn't disagree more. You guys know where i stand, i don't want to argue matters of personal opinion any further. But in my opinion Java is a very elegant language. I don't understand how someone can know Java and call it inelegant. Bulky, i agree with because there is alot of code that might be deemed superfluous, but it is certainly an elegant language. It is the most Object Oriented language i know.
     
  18. Apr 10, 2006 #17

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    It's inelegant, in my opinion, because of its rigidity and its bulk. Elegant languages let you accomplish complex tasks easily, with simple, readable, easily-maintained code. An ideal programming language allows the programmer to focus on the specific operation of his/her program; Java requires so much skeleton and bookkeeping code that programmers are distracted from the meat.

    On the other hand, Java does a good job of enforcing good programming standards (like catching exceptions, respecting encapsulation, and so on), so I give it credit there.

    In my opinion, Python is the most elegant language in use today. Rarely ever do you find yourself muddled in its syntax, and its high-level features are dramatically more useful than those of Java.

    - Warren
     
  19. Apr 10, 2006 #18

    -Job-

    User Avatar
    Science Advisor

    Java programs are easier to maintain than C programs. They are more modular and object oriented not to mention they are far more readable. Elegance in my opinion is connected with how something is structured, and Java is a very well architectured languaged. I can't say the same for C. I don't want to put down C, but i feel that not arguing for Java's elegance would earn me a beating by the Java community. It's practically what the language stands for.
    I'm not familiar with Python, but i'm definitely going to look at it to see if you are correct.
     
  20. Apr 10, 2006 #19

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    In my opinion, "structure" has very little to do with elegance. Imagine that someone uses Language X to write a concise, functioning program with only a few passes through the compile-execute-debug cycle, then hands it to me. I pick it up, look at it briefly, and can see immediately what the program intends to do, how it performs the intended function, and whether or not it's likely to contain bugs. That's elegance. I could care less how strict or explicit the language's syntax is.

    That was Java's hallmark "feature": it appealed to purists with its extremely strong typing and explicit, verbose, formal syntax. The architects of Java felt that if you eliminated "syntactical shortcuts," you could enforce good programming practices, and thus create better-quality code. This approach is arguably successful; Java programs are certainly much less "gotcha"-prone that are C programs. On the other hand, Java fails to appeal to the way human beings actually approach a software engineering task. It provides a million classes, but virtually none of the low-level tools involved in efficient algorithm design. Languages with built-in (syntactically trivial) support for lists, dictionaries, hashes, iterators, and other algorithm building-blocks permit rapid, obvious, and correct algorithm design. Consider that the collections hierarchy was only introduced to the Java language somewhat recently, even though such structures are essentially the bread and butter of all algorithms. At least they're present now, but their use is still crippled by all the unnecessary syntactical baggage of the Java language itself.

    I'll note that I used to be in your camp: I used to think Java was the greatest thing since sliced bread. I used to teach classed on it. I tried to use it everywhere, all the time. I eventually got over it and found better languages. I still find situations where Java is the appropriate language, but they're becoming more infrequent every day.

    - Warren
     
  21. Apr 10, 2006 #20

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    You're speaking out of ignorance. Languages like Python, for example, are much, much higher-level than Java, and are rapidly gaining market share.

    - Warren
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: C or Java?
  1. C to Java (Replies: 9)

  2. Java &c++ (Replies: 1)

  3. C or Java? (Replies: 18)

  4. Java or C/C ++ (Replies: 5)

  5. Java OR C# (Replies: 3)

Loading...