What is a good programming language to learn for Mech E ?

In summary: The C++...The C++...by Stroustrup. DON'T read this guys books. He's the creator of C++ and he's a moron. These books are full of really bad advice and the language sucks. I include it only because most C++ programmers worship him. *** JavaThinking in Java by Eckel. I really like this one. There are a lot of other good books on Java, but I haven't read any that are specifically for people who already know how to program. *** General programmingStructure and Interpretation of Computer Programs by Abelson and Sussman. This book is available for free download. It is the best book I have ever read on programming, period. It is
  • #1
Saladsamurai
3,020
7
Like it says. I am studying Mechanical engineering and I would like to get familiar with so programming language. I was thinking of Java or C++. I am leaning more towards the latter. However, I have heard that they are both a little outdated. I am of the opinion that if I learned C++, regardless of what's current, it would be helpful.

Are most languages similar? That is, am I correct to say that if a learned C++, I could pick up another language without much difficulty?


Also, of I do go with C++, is anyone familiar with this text. https://www.amazon.com/dp/0672324482/?tag=pfamazon01-20

Thanks!
 
Physics news on Phys.org
  • #2
C++! However, Java is replacing niches that C++ once held like in financial engineering. I don't think it'll replace really anything in engineering any time soon.

BTW, I hate computer science. That field moves really fast!
 
  • #3
Saladsamurai said:
Are most languages similar? That is, am I correct to say that if a learned C++, I could pick up another language without much difficulty?

Yup. Once you learn one, others are really easy to pick up. The same concepts apply, and you just have to learn the quirks of the language and their syntax (what their commands are, basically).

Either of these will work fine for a first language.

C++ is by far more powerful than Java, but Java is definitely easier to pickup and both are popular enough that it's a personal decision which to learn first.

So it depends on how much time you want to spend on learning it. If it's just a tool to make you more employable, go for Java. You might have to learn C++ later anyway, but by then they'll probably be paying for you to get up to speed. ;)
 
  • #4
Thanks people!

Any thoughts on the Sams book?
 
  • #5
Physics1 said:
Java is replacing niches that C++ once held like in financial engineering.

Not even remotely close to being plausible, never mind true.
 
  • #6
Matlab?

By the way, anything involving large scale simulations (Computational science, engineering, computational finance) requires performance. Java is easy to learn and easy to write (so is C++, imo) but it's an absolute sloth. C++ will not be replaced in these areas any time in the foreseeable future, and it certainly won't be by Java. Hell, FORTRAN is still popular among these folks!
 
  • #7
What is the difference between Matlab and C++ ? I mean, I see the name Matlab and naturally I think MATH. What can C++ be used for that isn't math?

That may be a silly question:redface:
 
  • #8
I can throw in my ramblings as a reasonably experienced programmer who does not know mech e. Maybe this is irrelevant to you, so disregard if you wish.

C++ is an absolute mess of a language. However it is widely used and if for whatever reason your field extensively uses it, well, then you have no choice. In any case, though, I would most definitely NOT recommend it as a first language if possible.

Java was initially conceived as a cleaned up version of C++. Personally I think it would be a much better place to start than C++ (although not ideal). The best thing about Java is not the language itself, it's the platform. Do you need to write a program that runs on Windows, Mac OS X, and Linux, that communicates over a network, that has a graphical interface, and that uses a database? In Java, no problem, libraries to help you do those things are built in. In C++?... Good luck.

I don't approve of the "Learn X in 21 Days" type of books. Writing code is a serious endeavor. Unfortunately there are a lot of people writing awful code and a lot of awful programming books out there. If a superficial understanding can get you by for what you need, then so be it, but I don't like to do things halfway.

The poster above says languages are easy to pick up once you know one. I mostly agree. For instance, an experienced C++ programmer is not going to have a problem learning Java. However, some languages, especially non-mainstream languages, have different paradigms that can be hard for users of other languages to wrap their heads around. When object oriented stuff first started getting popular, a lot of people had a really hard time understanding what it was all about. Some people never did.

As far as being "outdated"... Some of this has more to do with what's trendy than anything else. Java was extremely fashionable a few years ago; much less so now, although still widely used. But its technical merits haven't really changed. It's a mundane object oriented language with extensive libraries, 8 years ago and today. The people who were saying it was the greatest thing ever a few years ago now look stupid, as do the people today saying everyone should stop using Java immediately.

To throw in my last little tidbit... I think all these mainstream languages are crap. There are some really, really amazing languages that 95% of programmers just ignore because they won't help you get a job. ML, Haskell, and especially Lisp. There is a great little Lisp dialect called Clojure which I love to death and which is built on the Java JVM, so you have access to all the Java libraries. Unfortunately your language decision likely has more to do with what language your colleagues will be using than its technical merits, so do what you must.

Book recommendations:

*** C++

Unfortunately many C++ books teach a style of C++ from before C++ was standardized 10 years ago. These are good ones:

Accelerated C++ by Koenig and Moo. Teaches modern C++ for a beginner.

Effective C++/More Effective C++/Effective STL by Meyers. C++ has a LOT of pitfalls. These will help you avoid them. I consider Effective C++ pretty much essential. (These will NOT teach you the language, though.)

Exceptional C++/Exceptional C++ Style/More Exceptional C++ by Sutter. These are basically more advanced versions of the above. Read after you have a little experience.

The C++ Programming Langauge by Stroustrup. The definitive book by the creator of C++. Not appropriate for a beginner though.

*** Java

Unfortunately I don't know a good beginner's Java book. I'm sure there are some out there but there are tons of garbage ones also. I have:

The Java Programming Langauge by Gosling.

Effective Java by Bloch. Analogous to Effective C++ above. Do not attempt to write serious Java code without having read this book.

*** Other

If you have time to devote to this and actually want to become good at it, I strongly recommend Structure and Interpretation of Computer Programs by Abelson and Sussman. It's actually available for free online from MIT: http://mitpress.mit.edu/sicp/ It is supposed to be for a complete beginner, although it doesn't provide as gentle an introduction as I would think ideal.
 
  • #9
i vote matlab. cas systems are fast enough. computer are cheap, MATLAB has parallel processing packages etc etc. if you spend the amount of time learning to use c++ that it requires you will have wasted a great amount of time that could've been spent studying engineering. leave the computer science to the computer scientitsts.

matlab stands from matrix laboratory. there are so many useful things in MATLAB that i guarantee if you devoted as much time to learning it as you would need to devote to c++ you will be a much more capable engineer.

i would compare solving a problem in c++ and MATLAB like digging a trench with a shovel versus an excavator. yes the shovel can get into corners and is neater but yea... no one digs trench with shovels now that we have excavators.
 
Last edited:
  • #10
Saladsamurai said:
What is the difference between Matlab and C++ ? I mean, I see the name Matlab and naturally I think MATH. What can C++ be used for that isn't math?

That may be a silly question:redface:

Matlab is a language and computing environment geared towards math. C++ is a general purpose language. Your web browser was probably written in C++. Microsoft Office is written in C++. Many computer games are written in C++. etc.

EDIT: sorry, ice109, didn't mean to step on your toes with my response; it hadn't appeared when I began my reply. And I would have to agree that a specialized environment like Matlab is probably best IF it can actually do everything you need it to.
 
Last edited:
  • #11
lol you didn't cause your post didn't show when i started writing mine either
 
  • #12
Okay guys. Thanks! :smile: I already bought a Matlab book before I started this thread so I guess I'll just stick to that!

On the same token, do you think if become 'fluent' in Matlab, wouldn't C++ be a little easier to pick up?
 
  • #13
Saladsamurai said:
Okay guys. Thanks! :smile: I already bought a Matlab book before I started this thread so I guess I'll just stick to that!

On the same token, do you think if become 'fluent' in Matlab, wouldn't C++ be a little easier to pick up?

yes it would since programming concepts are pretty much universal
 
  • #14
I'm an ME and code frequently, like four hours on an average work day. My first choice would be Matlab. Its basically an industry standard for scientific computing. While you it is based off of C, it is a bit different. And about 8,000^67,000 times more powerful then just C++.

My second choice would by Visual Basic (Applications). Why? Its simple, easy, used in all Office applications including Excel, and will do everything as well as C++ can but keep it neat. Since computers are getting pretty cheap and powerful these days, efficient code isn't such a big issue anymore.
 
  • #15
I would vote Matlab, too.
However, I think that learning proper and clean coding is more important than any language, i.e., learning OOP etc.

Languages and software are what you make them.
VBA is aesthetically repellent to me, but sometimes that is all you have. I would wait until you are forced, if ever to learn.

Keep in mind this is not from an ME perspective, in fact they never seemed that interested in programming.
 
  • #16
Thanks for the replies guys!
 

FAQ: What is a good programming language to learn for Mech E ?

What is a good programming language to learn for Mech E ?

1. What programming language is most commonly used in the field of Mechanical Engineering?

The most commonly used programming language in Mechanical Engineering is MATLAB. It is widely used for data analysis, modeling, and simulation in this field.

2. Is it necessary for a Mechanical Engineer to learn programming?

While it is not a requirement, learning programming can greatly benefit Mechanical Engineers. It can help with automating tasks, analyzing data, and creating simulations.

3. Which programming language is best for beginners in the field of Mechanical Engineering?

If you are new to programming, it is recommended to start with Python. It has a simple syntax, a large community, and many libraries that are useful for mechanical engineering tasks.

4. Are there any specific programming languages that are used for a certain aspect of Mechanical Engineering?

Yes, there are programming languages that are specifically used for certain tasks in Mechanical Engineering. For example, FORTRAN is commonly used for computational fluid dynamics and C++ is used for finite element analysis.

5. How can learning a programming language benefit a Mechanical Engineer's career?

Learning a programming language can make a Mechanical Engineer more versatile and valuable in the job market. It can also help with problem-solving, data analysis, and automating tasks, making them more efficient in their work.

Similar threads

Back
Top