Courses Recommended computer science course

Click For Summary
SUMMARY

The recommended computer science course for science majors primarily utilizes Java due to its cleaner syntax compared to C and C++, automatic garbage collection, and robust exception handling. Java's platform agnosticism and standard graphics library make it suitable for teaching programming concepts effectively. While it is acknowledged that Fortran and C are prevalent in scientific computing, Java serves as an excellent introductory language that prepares students for various programming paradigms. Ultimately, Java is not merely a teaching tool; it is also employed in serious applications, although it may not be optimal for high-performance numerical analysis.

PREREQUISITES
  • Understanding of Object-Oriented Programming (OOP) concepts
  • Familiarity with Java programming language syntax and structure
  • Basic knowledge of exception handling in programming
  • Awareness of platform independence in software development
NEXT STEPS
  • Explore advanced Java features such as generics and lambda expressions
  • Learn about performance optimization techniques in Java applications
  • Investigate the use of C++ for high-performance numerical analysis
  • Study the differences between Java and Python for scientific computing
USEFUL FOR

This discussion is beneficial for computer science students, educators, and professionals in scientific computing who are evaluating programming languages for teaching and application development.

cscott
Messages
778
Reaction score
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
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) a lot 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:
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
 
So it is basically used to teach, or is it also used in serious numerical analysis and whatever else physicists use programming for?
 
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++
 
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
 
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.
 
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.
 
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
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 21 ·
Replies
21
Views
4K
  • · Replies 13 ·
Replies
13
Views
5K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 14 ·
Replies
14
Views
2K
Replies
19
Views
4K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 11 ·
Replies
11
Views
3K