DEV Community

Cover image for Why Java is the best Programming language to Learn Coding for beginners?

Why Java is the best Programming language to Learn Coding for beginners?

javinpaul on September 30, 2019

Disclosure: This post includes affiliate links; I may receive compensation if you purchase products or services from the different links provided i...
Collapse
 
leobm profile image
Felix Wittmann • Edited

Java is easy for beginners?

Here the "Hello World" program in Java:


public class HelloWorld 
{

       public static void main (String[] args)
       {
             System.out.println("Hello World!");
       }
}

Enter fullscreen mode Exit fullscreen mode

You have to explain a lot of complex topics.

  1. What is a Class ?
  2. What is a Function ? e.g. what does this special main function ? What is args ?
  3. What does the static keyword ?
  4. What is String[] ? You have to explain Types String,Array
  5. What is System.out ? You have to explain Packages

And now in Python:


print("Hello World!")

Enter fullscreen mode Exit fullscreen mode
Collapse
 
petergabriel2 profile image
PeterGabriel2 • Edited

But nobody will stay with single command program.
There is not a problem if you have to explain what is the class and the object. You don't have to explain it on a first day.

Problem with Python is that that language IS NOT intuitive and you will have much worse dilema later.

After years of C# and Java and Pascal/Delphi and PHP and ... we are teaching young people Kotlin and it has never been better language for doing that.

I hope that one day Kotlin will be also more popular in AI in comparison with Python. I have tried Python but I will never be able to use to it.

Collapse
 
joelbonetr profile image
JoelBonetR 🥇

There's php code:
echo('hello world'); this is just the reason for learning Java or other "more strict" languages before Dynamic ones, if you give a kid a php or python or... Similar languages it will be a mess due to non understanding of what a class is etc (and tell me how to work with Python without packages)

Collapse
 
michelemauro profile image
michelemauro

A similar answer (for the same reasons) can be given for Scala.

And when you learned Scala, you won't even need to downgrade to Java 😁

Collapse
 
alansolitar profile image
Alan Solitar • Edited

I think c/c++ is better for teaching underlying programming concepts. Particularly in regards to to memory allocation and pointers. However, if one wants to learn programming for practical "I want to get a job" reasons, then Java is a solid pick I suppose.

Collapse
 
curtisfenner profile image
Curtis Fenner

It's valuable to eventually learn concepts like pointers and memory management.

However, they're not critical to learning programming (and increasingly becoming less relevant as compiler and languages improve automatic/checked management of memory and resources), and distract from far more important concepts like abstraction, schemas, patterns, etc. (a lot of other misfeatures in C and C++ are also bad distractions).

Collapse
 
alansolitar profile image
Alan Solitar

If learning programming then I agree. If learning computer science, then the lower level stuff is usually better for learning concepts. It all depends on your goals.

Thread Thread
 
curtisfenner profile image
Curtis Fenner

If anything, the opposite is true. Computer science does not care about pointers, nor do they care about "low level" details, since those are implementation details that are dependent on hardware.

Pointers don't show up in the formulation of computation in many models (lambda calculus models, Turing machine models, stack machine models...).

They are not particularly important conceptually (in fact, the unsafety of general pointers makes it nearly impossible to talk meaningfully about any nearly computing concepts; you need to severely restrict the discussion to pointers used safely in particular patterns, which is very hard to actually do accurately). They are merely the way that hardware generally implements "constant time" array access.

Even then, that's not true -- there is no such thing as constant time access to memory!

The fundamental concept is just maps, which is entirely obscured by the messiness of pointers.

Thread Thread
 
bobbyconnolly profile image
Bobby Connolly • Edited

what a great comment by Mr Fenner

 
alibas13 profile image
Ali Bas

Hi Alan,

Exactly, do you advice books or sites or blogs to learn the lower level stuff to better learning concepts?

Thanks

Collapse
 
yoadev profile image
Younes

I totally agree with you

Collapse
 
javinpaul profile image
javinpaul

hello @Alan, you have a point, Definitely.

Collapse
 
jonasbarka profile image
Jonas Barkå

I think Python is hands down the best choice for beginners, and I don't even like it that much.

If you prefer a language with static typing I'd argue C# is marginally beter than Java.

Collapse
 
mschleckser profile image
MSchleckser

I'd say start with either C# or Java. They both allow you to work with pass by value and pass by reference. They enforce static typing which forces young coders to think about how they are developing. And both have huge enterprise and enthusiast communities behind them.

Collapse
 
greyfade profile image
Charles Banas

Marginally?

Where Java tried and failed to be a "better C++," C# succeeded at being a better Java

Collapse
 
olvnikon profile image
Vladimir

Python is multi-paradigm and Java is imperative OOP only. The biggest problem that at the moment pretty much every school teaches you how to write imperative code leaving the possibility to learn declarative functional programming to you with no help. I agree that for low level programming languages imperative code is reasonable and it is still good to know how memory gets allocated and Java doesn't give it. Picking up such language as python gives you freedom in choosing, which paradigm you want to stick with, or at least improving skills right from the beginning. Many developers don't want to learn FP nowadays because they spent years on learning only imperative programming and used it on their work so even mentioning FP makes them angry and dissatisfied.
So I think that C/C++ is still a must and python is a good choice for the next language.

Collapse
 
cappe987 profile image
Casper

How often do people actually write in functional style in Python though? OOP/imperative is still the first thing most Python programmers will learn.

Collapse
 
olvnikon profile image
Vladimir

Because imperative code is much closer to how human brain works. Line by line. FP is a bit difficult from the beginning because it forces to think in a different way. That's why it is always easier to start with imperative coding. However, if the tool also provides the possibility to write declarative code there is a chance developers try it. Java cuts this possibility making new developers OOP oriented only.

Thread Thread
 
cappe987 profile image
Casper

You've got a point. I totally agree that more people should learn FP. But learning declarative in an imperative-first language means that if you can't solve it in declarative there's a big chance you fall back into your comfort zone. If you are looking to learn declarative for educational purposes you're better off choosing an functional-first language. Programmers are expected to learn multiple languages eventually.

I'm not saying to not learn Python first. My point is that these so-called "multi-paradigm" languages are still very much focused on imperative (most of them at least), and choosing Python for the sake of it isn't a good reason.

Collapse
 
greyfade profile image
Charles Banas

More often than even they realize.

The moment you write your first generator expression, you've already discovered the power of a functional style.

Yes, they start out with OOP (in a rather Self-like style), but much of the language does, despite Guido van Rossom's poor understanding of it, in fact support strong functional style very well, and Python programmers learn it very early on.

Collapse
 
petergabriel2 profile image
PeterGabriel2

I agree with article because Java is simple, that's why is a good language for beginners. And it is equal to C# in this case.

But Java has one big problem - after you try Kotlin, you never want to go back to Java or C# or C++ or Python...

Collapse
 
jalbertsr profile image
Joan Albert Segura

How is Java syntax easier to read than JS, Ruby or Python?

Collapse
 
michelemauro profile image
michelemauro

Almost every language is easier to read than (not very curated) JS 😬; Perl being one of the exceptions, of course.

On the other hand, it's a bit harder writing unreadable code in Python, Ruby, or even Java.

Collapse
 
psvpl profile image
Piotr Szeptynski • Edited

Java was my fourth or fifth language to learn in my life and I would not dare to say it is good for beginners. Yes, I started with Basic 30+ years ago.

Collapse
 
petergabriel2 profile image
PeterGabriel2

I found out that huge impact in this process has an IDE.
Until I tried IntelliJ IDEA I was not able to work with Java either.

Collapse
 
gbudiman profile image
Gloria Budiman

"Java is... Simple... Reads like English"

Lol.

Either it's a troll statement or someone is being ignorant to the existence of languages like Py/Ruby.

Collapse
 
lucis profile image
Lucis

Nop, that's Python

Collapse
 
petergabriel2 profile image
PeterGabriel2 • Edited

Python is just so boring language. In comparison to many other languages looks old and misses modern concepts.
Moreover, it is quite different from C#, Java, Kotlin, Delphi... so if somebody wants to learn or work in those languages Python is not a good choice to start with.

Collapse
 
ginsburgnm profile image
Noah Ginsburg

How is python a boring language? There's so much you can do with it, it's used for ML/AI research. That's pretty not boring.
Python3 is pretty modern, yes there are oddities that you need to be aware of when switching over. But it's a great language to learn on.

Collapse
 
avalander profile image
Avalander

I first learned programming with python and then I coded professionally in Java many years. Never had any issues translating my knowledge from one language to the other.

Collapse
 
michelemauro profile image
michelemauro

Being a boring language is a plus when learning the first one. And Python is pretty complete both in applications and ecosystem.

Collapse
 
snek profile image
Gus Caplan

I've found that my peers who learned programming through java think of code more in terms of blocks of text, while those who learned via python/lispy pathways think of code more in terms of values and control flow. I think the former is rather damaging.

Collapse
 
mschleckser profile image
MSchleckser

As someone who started with Java I most definitely do not think in "blocks of code" when I develop I see the flow and system as a whole. It sounds like your Java friends need more experience.

Collapse
 
pbelx profile image
Peter B

I think it comes down to what an individual wants to accomplish.
That will dictate what language they should start with.Do they want to do game programming or full stack web design?.There can never be a best language to learn coding.

Collapse
 
javinpaul profile image
javinpaul

Hey Peter B, I think you have a point. If you want to quickly develop a website then definitely its lot easier in Python and Ruby than Java, but at the same time for getting a job and working in a large project in a big company, Java is always preferred over Python/Ruby.

Collapse
 
w3bist profile image
Webist

Java and java-like languages are wrong implementations of software development.
Indoctrinations with concepts such as abstract classes, inheritance by extending which suppose to represent real life objects wil hurt you.
Software development is much simpler than that. Learn how to use association relations. You might read somewhere 'Composition over inheritance'. Again, the reality is that the inheritance by extending should not be there at all.

To learn software programming, not to confuse with software development, learn a functional language that do not bother jou much with objects.

Collapse
 
ginsburgnm profile image
Noah Ginsburg

Just because you don't like OOP doesn't mean it's wrong. You actually gave no reasoning for it to be wrong, which you really should for making such a widesweeping claim against the vast majority of the top languages.

Collapse
 
alohci profile image
Nicholas Stimpson

I miss C, for exactly the same code. :-)

Collapse
 
greyfade profile image
Charles Banas

Or Kotlin.

Collapse
 
greyfade profile image
Charles Banas

I have to say that this article is extremely disappointing. I think the author is expressing clear bias and an unfamiliarity with languages he is criticizing.

About the only factual statement made in the entire article is that Java will "help you get a job." This being one of the worst reasons to learn a language, in my not-so-humble opinion.

Yes, Java does have strong institutional presence in the industry, but not often for any good reasons. But that's not a point in its favor, but a neutral one at best.

The syntax, however, is absolutely not "more readable" than C or C++. Java is rather more verbose than modern idiomatic C++, and significantly less readable than C#. It is also certainly not easier to understand than Python, and I question the author's qualification to make such an assertion. Having tutored several beginners in both Java and Python, I can say with certainty that Java is abominably more complicated and difficult for beginners to understand.

I'd also assert that Java's concept of OOP is fundamentally broken. It tried, and failed, to be a "better C++" by going whole-hog on Simula-style OOP, and the travesty of "Enterprisey" code, with its FactoryFactories and CommandManagerFactoryActors, is exemplary of everything wrong with the Java platform and community. Java programmers read GoF as their Bible, when they should read it as the cautionary tale that it is.

Alan Kay was right: Java is not OOP, but Smalltalk is.

Author, stick to your day job. Please.

Collapse
 
bobbyconnolly profile image
Bobby Connolly

Personally I'd just teach JavaScript to a beginner since web development is always in high demand

Collapse
 
javinpaul profile image
javinpaul

Definitely not a bad idea, but there was a reason they teach Java in academics. JavaScript is a must if you want to do web development.