Recommended computer science course

In summary, Java is the recommended language for a computer science course for science majors because it is simpler and more platform agnostic than other languages.
  • #1
cscott
782
1
From a few university webpages I see the recommended computer science course for science majors utilizes Java. Is there any particular reason for this? I thought Fortran (and others like C/C++) was the main programming language of science...

Edit: Oops, I didn't mean to post this in academic & career guidence section...
 
Last edited:
Physics news on Phys.org
  • #2
I can think of a couple reasons

1) Syntax is cleaner than C, and much, MUCH cleaner than C++ for the OO stuff.

2) No header files or other preprocessor mess to deal with. No linking stage the programmer has to deal with (its all done dynamically). Therefore, no makefiles to deal with. Make sure your CLASSPATH is set right, and you are good to go.

3) No need for messy pointers or screwy C++ references. Every non-primitive variable (i.e. everything not an not int, float, char, etc.) is passed by reference.

4) Automatic garbage collection. You don't have to specifically deallocated every object you instantiated. C++ has smart pointers implementations but they are not built into the language so they are not as nice.

5) Automatic array bounds checking. Helpful when you are trying to debug, and have no idea why your pogram quits with some weird error "Access violation 0x00e48d at 0x08343d"

6) Exceptions. C++ has these, though I have never encounterd code that actually uses them, because the standard libraries don't use them. To tell the truth it can get annoying in Java to have to either catch or throw every single exception. But in the end, it makes your programs a lot more robust and gives much more meaningful error messages than something like what I wrote in 5). And Java exceptions include a full stack trace.

7) No multiple inheritance. Java classes can implement multipe interfaces, which are akin to pure virtual classes in C++, but they cannot inherit from more than one class. Granted, you don't have to actually use this feature, but rest assured other programmers will. And someday you might have to read their code.

8) Alot more platform agnostic than C and C++.

10) A standard graphics library and GUI, that works pretty well cross platform. C++ has a couple of these, but there are not part of a standard library and not as nice, although they are primarily because of the clunkiness of the C++.

These advantages far outweigh the disadvantages of Java (speed, templates are actually useful, I/O library is somewhat clunky ) for a beginning program course IMO. Perhaps Java is not the best language for an intro course (Python or god forbid, VB would probably be better for that), but for courses that are trying to teach concepts and not necessarily implementations, I understand why professors would prefer using it over C or its retarded OO cousin C++.
 
Last edited:
  • #3
i just took an intro to compsci course, and it was centered around Java programming. much like your situation. Java is a pretty clean, simple to use language. he did intro C/C++, and it was messier.

it was a fun course, just be open minded.

ps: writing Java programs that algorithmically solve problems are pretty cool
 
  • #4
So it is basically used to teach, or is it also used in serious numerical analysis and whatever else physicists use programming for?
 
  • #5
its a teaching tool in my opinion for algorithm/functions but people do use it for webapps. I hear its poorere in memory mgmt than c/C++
 
  • #6
Java is definitely not just a teaching tool. It's used in many "serious" applications, but it has its disadvantages, as have been described. Other languages like Python, Perl, Matlab (script), or C++ might be better for different applications. Your best bet is to learn a number of different languages, and use the best for each problem. Once you've learned a couple of languages, it takes little effort to learn another.

- Warren
 
  • #7
Java is an excellent first language for all the reasons that so-crates pointed out, it's also very powerful, once you get past the applet stage.

The most important thing to walk away with from your first programming class is an understanding of programming basics. Once you know how to: declare variables, declare and access arrays, call methods, write methods, create and use loops, do basic decision making with "if/then/and" statements, understand the concept of OOP, and are able to write a few simple classes, it's easy to move on to any language that interests you. The rest is mostly syntex and learning the libraries so you don't have to reinvent the wheel every time you need to accomplish something.
 
  • #8
I already know Python/C/Assembly and some basic C++/Java. I was really getting at the fact that Fortran and C are used a lot in science and that we should be learning those, but I guess I neglected the fact that they may not be the easiest first languages.

I agree with everything said here about Java, though.
 
  • #9
cscott said:
I already know Python/C/Assembly and some basic C++/Java. I was really getting at the fact that Fortran and C are used a lot in science and that we should be learning those, but I guess I neglected the fact that they may not be the easiest first languages.

I agree with everything said here about Java, though.
Pick the one that fits you most, the one that most interests you, and remember not to contradict yourself in any circumstances which can lead you to suffering ...
 
  • #10
Java is definitely a very powerful language that is not at all a "teaching" language, like possibly something like Pascal is these days. However, I don't think Java is usually the best language to run your typical physics program in, because it's reliance on running through a VM tends to really slow down large numerical calculations.

Java is great for GUI type programs, and web interface programs (where you don't know what type of machine / OS your web user will be using) or even cell phones (easy to animate and allows easy accessorizing and cross compatability)

but for heavy calculational physics programming, nothing beats C++ IMHO.

~Lyuokdea
 

1. What is a recommended computer science course?

A recommended computer science course is a course that is suggested or advised by experts in the field of computer science as a valuable and beneficial course to take in order to gain knowledge and skills in the subject. These courses are typically chosen based on their relevance, difficulty level, and practical applications in the field of computer science.

2. Why should I take a computer science course?

Taking a computer science course can provide you with a strong foundation in a wide range of skills and concepts related to computing and technology. These courses can also help you develop critical thinking, problem-solving, and programming skills that are highly sought after in many industries.

3. What topics are typically covered in a computer science course?

Computer science courses cover a variety of topics such as programming languages, data structures, algorithms, computer architecture, software development, and computer networking. These courses may also delve into more specialized areas such as artificial intelligence, cybersecurity, and mobile app development.

4. Are there any prerequisites for taking a computer science course?

The prerequisites for computer science courses may vary depending on the specific course and institution. However, most courses will require a basic understanding of mathematics and logic, as well as strong problem-solving skills. Some courses may also have specific programming language or software requirements.

5. How can I find the best computer science course for me?

There are several ways to find the best computer science course for your needs. You can research online to compare course curriculums, read reviews from past students, and check the credentials of the instructor. It's also helpful to consider your own interests and goals in order to choose a course that aligns with your career aspirations.

Similar threads

  • STEM Academic Advising
Replies
3
Views
819
  • STEM Academic Advising
Replies
1
Views
439
  • STEM Academic Advising
Replies
6
Views
1K
  • STEM Academic Advising
Replies
12
Views
1K
Replies
19
Views
2K
  • STEM Academic Advising
Replies
10
Views
1K
  • STEM Academic Advising
Replies
13
Views
3K
  • STEM Academic Advising
Replies
3
Views
927
  • STEM Academic Advising
Replies
11
Views
635
  • STEM Academic Advising
Replies
7
Views
2K
Back
Top