The official I don't know Java thread

I’m wanting to learn to develop plugins and such with Sponge.

Thx for this e-book, great material!

As for German, I can recommend “Java ist auch eine Insel” (mainly for beginners, http://openbook.galileocomputing.de/javainsel/) and “Java 7 - Mehr als eine Insel” (better experienced programmers, http://openbook.galileo-press.de/java7/). They’re easy to understand and free (they’re openbooks). /request for more languages

Actually, Scala has been working on a lot of cool metaprogramming stuff in the time since that answer was posted.

C# and Java are practically equivalent. When it comes to language abstraction level.

Groovy is a lot slower, since it basically moves the functionality of javac to the runtime instead, meaning that for, say, application start there is a lot of machinery that has to be loaded. Also, because of its dynamic nature it fights quite a bit with the JVM (causing slowdowns), but this is improving in recent times.

Scala itself is on par, performance-wise, with Java.

However, Scala has a lot of features that (and encourage coding styles that) can be either faster or slower than Java, depending on what you’re doing, how you’re doing it, and what equivalent you’re comparing it against, if one exists. For example, on common pattern is ‘pimp my library’, where you adapt a Java library for Scala by providing a way to implicitly convert an object to some other type, which would cause a lot of garbage to be generated. However, this is also improving in recent times, with the addition of things like value types allowing you to have ‘fake objects’ that don’t really exist.

So what would I recommend?

I’d say go for Scala. It has access to the huge amount of Java libraries, it is functional enough that you won’t have to write a lot of boilerplate, but still typesafe enough that it encourages proper habits.

Can you write Groovy or Scala code directly into eclipse?

Yes. But I prefer IntelliJ over Eclipse.

Groovy Eclipse Plugin
Scala Eclipse Plugin

2 Likes

I just started learning java a few weeks ago and it doesn’t seem that bad. I started with some YouTube tutorials, but decided to just jump into doing exercises which I prefer. I’ve had previous programming experience with a language called Matlab which I was taught as part of the engineering program at my university, and it’s similar to java with a lot of the fluff taken out. So my advice would be just to jump right into java and start doing exercises.

Java isn’t that bad until you realize what you’ve been missing out on. Same could be said for PHP.

Java first can be hard because it’s not just “programming” you’re getting into, but also a few decades of language design.

Compared to, say, Python 2:

print "hello world"

Which fundamentally, to the user, is just an instruction.

Java has classes, objects, packages, and so on – which all exist for a reason – but you have to work with them (even a little bit) before being able to do something.

That said, it’s not too hard. However, from what I saw in programming classes, some people “just get” and other’s “don’t get” the idea of classes, interfaces, etc. They just couldn’t wrap their head around the idea of them.

3 Likes

While that is true, you could begin by keeping everything static and first both classes and (static) methods as ‘just stuff you write around your code’, gradually revealing that that is not really the case.

I would definitely suggest learning a basic scripting language first to understand the concept behind programming. Making bash scripts has the benefit of emphasizing that everything you do is essentially a command to the system. Java is the same way, but it requires a lot more syntax to describe how commands should be executed. Much of this can get in the way of learning actual concepts from the ground level because you spend most of your time trying to understand what “public static void main” means.

After toying around a bit with some shell scripting languages, I would suggest moving up to a more powerful scripting language like Python. It has the added benefit of also being object oriented. Some people don’t like the syntax (I think they are just used to their flood of semicolons and brackets). A great place to learn python is at codecademy.

Java is really just a few steps over if you go in this direction. If you understand the basics of programming as applied to Python, you should be able to pick up Java rather easily, given some caveats. I would suggest checking out some courses online at places like udemy (or codeschool if they do java?). Outside of that, there are a few good courses on Youtube from people like TheNewBoston, as was mentioned somewhere above.

Most importantly, remember that most programming languages can do much of the same stuff. You choose a programming languages for its syntax, performance, and niche applications. Don’t learn Java because you want to do one specific thing, but learn a programming language in such a way that you can apply what you have learned to other languages and expand your skillset.

3 Likes

Yep. Difference between learning software development and learning a language. :slight_smile:

Don’t worry, I don’t know Java either. I plan on contributing to the community using my YouTube channel

As someone who thinks Java is a good language, here is a rational. Everyone who is already learning Java should just continue learning. Because of something called a type system, a way of making sure you make sensible operations on a set of data. The real world equivalent of not putting gasoline in your computer but only your automobile. Because data looks all the same to a computer, the type system is a way to stop such errors from happening.

As previously pointing out, the verbosity and way of thinking are a major hurdle to many people. It is no longer a simple set of step-by-step instructions, but a different way of thinking, a paradigm, about how a computer can operate on data.

Java has a strong static type system, the end result is that you must declare the type of each variable. The verbosity of Java has one major advantage, because it is explicit. As a consequence, you know exactly what the type of any variable should be. The static typing will stop you, at compile time, from doing anything nonsensical, e.g. taking a string and subtracting five from it. You can argue that there is a sane interpretation of such instruction, but will it be correct for every instance? This is another basis for Java’s verbosity.

Scala has a strong static type system. The reduction in verbosity is because the compiler is smarter about types and will try to figure it out if you omit it. The end result here is that you no longer need to explicitly write the type for most variables, the compiler will figure it out. However, the compiler is not all knowing and in certain cases you have to explicitly declare a type, because you know more than the compiler. The advantage with static typing is the error checking you get at compile type, your program is less likely to break when you run something.

Groovy and Python have a strong dynamic type system. Being a dynamic type system means that the language do not check for type errors ahead of time. However, being a strong type system, the language will stop itself from doing nonsensical operations while the program is running. Otherwise if it quacks like a duck, it will treat it like a duck, i.e. as long as an object has a the method or function you are trying to invoke on it it won’t complain. As a side note, while it is possible to write imperative python, where you don’t have all the boilerplate of writing your own objects, the standard library for python has lots of objects, so you will still need to think and reason about objects. The advantages with dynamic typing is that it is easier to start writing before you dive into the complexity from strict types.

JavaScript, and many shell languages, are interesting because they tend to have a weak dynamic type system. For certain data types the language tries to take what you have written and make it work, often leading to very strange results. This implicit coercion of types can lead to very strange bugs.

In the end, which language you ultimately stick with will be a factor of what you prefer, as well as the conditions that you need to work in. Basically, if you learn Java, as part of learning Java, you should understand the type system and make it work for you.

As an additional note, the type system in C and C++ are basically used in Java, that having been said, newer versions of the language has type inference. These a lot of rope to hang yourself by making you manage your memory. That having been said, it will also make you aware of how to manage memory.

3 Likes

Yeah… let’s not talk about the JS type system.

2 Likes

Just saying Groovy is very nice to work with if you know what you’re doing :smile:
It can be annoying to get the hang of if you learnt Java beforehand, but in my opinion it’s still much nicer to use.

I think I tried to use Groovy with Bukkit once but it rejected it and said no GroovyObject class could be found :frowning:

1 Like

I don’t understand why this link hasn’t been posted yet: The Java™ Tutorials
The primary source (almost) always is the best source.

About the definition: If you’re able to solve problems with Java, you know it. That’s mine. There’s no official one and I think it’s easy to start a fight about it.

3 Likes

Java is very huge, If you want to get into java (even if you dont have any programming experiences) i think its fine to start with jse. And then its up to you how you will want to continue, if you will want to stick around and earn some €/$ i’d suggest you to look at jee or android (only few companies are using jse for their projects)

Anyway: help me with a few things: Define “knowing Java”, and tell me the best way to start from there.

For me this means you can work with jee (jaxrs,jsp,jsf, ejb… you should be also able to maintain server and frameworks such as glassfish, jersey…), jme …, and also understand how vm works