Learning Java vs Python

Thread Starter

mnobeidat

Joined Dec 20, 2016
20
Hi
I started learning Java a couple of months ago, and read some articles about different programming languages.
I found that Ruby and Python are easier and more common than java.
I'm studying electrical engineering, so what language is more useful in this field?
 

djsfantasi

Joined Apr 11, 2010
9,163
There are fanatics for each of those languages you've mentioned. There are interesting differences between them, for which I suggest you use Uncle Google!

But to your question, let's start with Java.

I am not sure about EE, but in the computer field, Java is going the ways of the dinosaurs.

Ruby is a little more popular than Python, but you are missing the most sought after language today.

PHP.

There are many comparisons online, but look at this one.
 

WBahn

Joined Mar 31, 2012
30,052
Is PHP used for much of anything beyond web scripting?

I certainly couldn't imagine writing a circuit simulator in PHP, let alone writing code for an embedded microcontroller or an FPGA.

In general, the more languages you know the better you are able to evaluate their strengths and weakness and thereby make good decisions as to which language is a good (or bad) match for a given application.

The field of electrical engineering uses programming languages in so many different ways that there simply is no way to say which language is most useful -- it is SO highly dependent on what you are trying to do with it at any particular time.
 

ErnieM

Joined Apr 24, 2011
8,377
Over the course of my career I have used so many languages I could not possibly remember them all.

Learn how to program in any language, and learn how to do it well.

It will make learning your next language even easier.
 
Learn Python, C an C++ in that order.

Python is the language that is used in most STEM research. It is easy to learn, there is massive amounts of support and documentation, there is a cornucopia of libraries for realizing almost anything. It will provide a skill that is needed almost everywhere and enhance your future employment opportunities.

After Python I think two language that are very relevant for STEM are C and C++. Most embedded application are written with C or C++.

It is good to focus on the "Functional Programming" aspects of Python and C++. Functional programming languages are the current big thing. Python and C++ both support functional programming to certain extent.

Java is a good language for business focused applications. Although it can be also used for STEM applications, it is mostly used to provide a different way of manipulating and interacting with software libraries written in C or C++. I would not recommend Java for STEM. Only as a third or fourth language.
 

strantor

Joined Oct 3, 2010
6,798
Ruby is a little more popular than Python
IT IS? I'm surprised to hear someone say that. I've only ever come across is as an extension of Sketchup. But it seems like Python keeps popping up in everything I do.

you are missing the most sought after language today.

PHP.
PHP is sought after if you want to be a coder. If you want to make money as web programmer, sure PHP.



If you want to make money as an Electrical Engineer and you consider programming to be one tool in a box of many tools to help you along the way, I suggest Python and C/C++.
I haven't learned C/C++ but it's my understanding that most microcontroller programming software has a C/C++ extension, so learn that one and you should be able to program any uC out there. (again, that's just my understanding and I haven't gotten very far into to; correct me if I'm wrong).
Python as I said, has come up multiple times for me a tool in my box. It's very versatile, easy to use, and has lots of libraries to import.
I've used Python inside Blender to make interactive 3D simulations.
I've used Python with the tkinter library to design cross-platform UIs.
There are lots of applications using Python as an interface with hardware, for example this:
 

djsfantasi

Joined Apr 11, 2010
9,163
IT IS? I'm surprised to hear someone say that. I've only ever come across is as an extension of Sketchup. But it seems like Python keeps popping up in everything I do.


PHP is sought after if you want to be a coder. If you want to make money as web programmer, sure PHP.



If you want to make money as an Electrical Engineer and you consider programming to be one tool in a box of many tools to help you along the way, I suggest Python and C/C++.
I haven't learned C/C++ but it's my understanding that most microcontroller programming software has a C/C++ extension, so learn that one and you should be able to program any uC out there. (again, that's just my understanding and I haven't gotten very far into to; correct me if I'm wrong).
Python as I said, has come up multiple times for me a tool in my box. It's very versatile, easy to use, and has lots of libraries to import.
I've used Python inside Blender to make interactive 3D simulations.
I've used Python with the tkinter library to design cross-platform UIs.
There are lots of applications using Python as an interface with hardware, for example this:
Thanks for your input. I alluded to your points at the beginning of my post.
I am not sure about EE, but in the computer field, Java is going the ways of the dinosaurs.
As many people have stated, if you are totally new to programming, pick any one. And learn it.

Because learning to code really is two skills.

The first is learning the details of the language. The syntax and organization. This can be subdivided further. Data types. Operators. Flow control. IO. Functions.

The second overlaps a bit with the first, particularly in the areas of flow control and functions. I call it learning Programming Constructs. How to loop backwards. How to sort. How to convert/map between values. And a few others. This is code that you will use as a template in future code.

Once you learn the first part, you will know what to look for in your next language. So learning will be faster.

And the second area you will use as a guide, over and over again in many languages.

Good luck and enjoy (I code as a hobby for relaxation)
 
The languages that i know or have programmed with belong in a museum. I was exposed to C" back in the 1970's or about the time it was invented. You need to learn the "object oriented" concept.

For "Test and Measurement" if you need to go there, LabIEW is the deFacto standard, but it will TOTALLY weird you out. "Virtual instruments" execute when data is available and it's ICON based, so you "wire" it together much like a circuit.

"Python" doesn't seem like a bad idea.
 

nsaspook

Joined Aug 27, 2009
13,265
The languages that i know or have programmed with belong in a museum. I was exposed to C" back in the 1970's or about the time it was invented. You need to learn the "object oriented" concept.
I tend to disagree about needing to learn the "object oriented" concept for people just getting into electrical engineering directed Systems programming. (It all ends up as assembly after being compiled you know so OOP is about maintainable code) The need to have "operations on types" vs "types with operations" is the choice. If you're mainly moving and formatting data with a fixed and defined program state then full OOP is overkill because you need to think in a computationally disciplined manner.

Procedural/relational software design builds the foundation of making human mental processes mimic hardware processes so you tend to better understand the underlying real hardware nuts & bolts abstraction (program counters, registers and addressable memory ) when you DO need to use OOP for human or operational metadata interfacing. If you're building a one-shot fire and forget app, use the method that works better for you. You don't need an OO language to use OO.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,163
To me, OOP is nothing unusual. Once you have programmed for a long time, OOP is just another paradigm for expressing a process. In fact, OOP can use many of the same "templates" as a procedural language. Your mind makes a shift in your point of view, and what was procedural becomes object oriented and vice versa. But you have to have many years of experience in coding.
 

WBahn

Joined Mar 31, 2012
30,052
I am not sure about EE, but in the computer field, Java is going the ways of the dinosaurs.
For a language that is going the way of the dinosaurs, it seems odd that Java is still the #1 or #2 ranking in almost all lists of programming languages used today.
 

djsfantasi

Joined Apr 11, 2010
9,163
For a language that is going the way of the dinosaurs, it seems odd that Java is still the #1 or #2 ranking in almost all lists of programming languages used today.
Not in my experience. In the cloud business, the cachet that Java had is no longer a business benefit. Java was poised to be a true multi-platform language, but it got sold. To a company who strongly believes in proprietary technology and the power of the licensing model. Not wanting to be beholden to a large company, there was incentive tostarted abandon Java.

My company did. And competitors did as well.

Java was quickly replaced by Ruby on Rails. The big company, seeing their market shrink because people did not want to pay their large fees, sold Java once again. Those who had yet to change tools, were now uncomfortable. Because what initially attracted them - stability offered by multi-platform capabilities - had been replaced by an unstable resource, whose ownership had bounced around for the last few years.

And the large company? They survived. Their business model was based on an almost exclusive lock on some of the best technology around. They miscalculated by taking on an open source product.

So in some markets, who weren't as dependent on bleeding edge core computer technologies, perhaps Java is #1. But those whose revenue is dependent on those core technologies, not so much.
 

WBahn

Joined Mar 31, 2012
30,052
I think that your explanation underscores a key point -- it's hard to make sweeping claims about any language based on its use (and trends) in a particular market. Probably for all of the widely used languages, there are going to be markets where the use is growing and other markets where the use is dwindling.
 

nsaspook

Joined Aug 27, 2009
13,265
To me, OOP is nothing unusual. Once you have programmed for a long time, OOP is just another paradigm for expressing a process. In fact, OOP can use many of the same "templates" as a procedural language. Your mind makes a shift in your point of view, and what was procedural becomes object oriented and vice versa. But you have to have many years of experience in coding.
OOP is nothing unusual (the Linux kernel uses many OOP concepts while being written in C) but it was being taught as the way to program so the OOP paradigm was and is being used for projects where it's a poor way to view the problem of managing computer hardware IMO. There's a lot of work in FP (functional programming) today so I'm playing around with Rust for system programming.

https://doc.rust-lang.org/book/README.html
 

djsfantasi

Joined Apr 11, 2010
9,163
I think that your explanation underscores a key point -- it's hard to make sweeping claims about any language based on its use (and trends) in a particular market. Probably for all of the widely used languages, there are going to be markets where the use is growing and other markets where the use is dwindling.
We can agree on this. I was trying to state this in my posts... or at a minimum allude to it. But you have been much more eloquent, direct and clear.
 

dl324

Joined Mar 30, 2015
16,916
I started learning Java a couple of months ago, and read some articles about different programming languages.
I found that Ruby and Python are easier and more common than java.
I'm studying electrical engineering, so what language is more useful in this field?
It depends on what you want to do. I started programming before Java, Ruby, or Python existed and I haven't done anything where I needed them.

Learning how to program is more important than learning a language. Like others, I have learned many languages. Each has it's pros and cons, but sometimes it's a matter of preference for the job. I once worked in a group that wanted everything coded in Perl and CSH. Not because they were the best languages, but because everyone knew how to use them, at least on a basic level, so even non-coders could hack on scripts. Electrical engineers aren't necessarily well suited for CS jobs, but the opposite is even more true.

A language is just a language. If you need to learn one, you can get most of what you need in a week. I know; that's how I learned most programming languages. The only times it took longer were in high school or college where the pace is glacial.
 
Top