# Is it worth learning Java? And what's the best way to learn it?

**URL:** <https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063>\
**Category:** Factual Questions\
**Created:** [August 28, 2009, 6:37pm UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063 "2009-08-28T18:37:49Z")\
**Posts on this page:** 11\
**Page:** 3

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [September 1, 2009, 10:56pm UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/41 "2009-09-01T22:56:28Z")

</div>

I agree that UPDATE statements in SQL are essentially imperative. But SELECT statements are definitely declarative; there’s no sequence of instructions, just a list of fields, joins, and functions which behave as filters. For example, consider a statement like

```auto

SELECT s.foo, s.bar, UPPER(s.baz), q.plork 
FROM sometable s
JOIN othertable q ON q.sid = s.id
WHERE q.plotz = "farfegnugen"

```

There’s a lot of stuff going on here – a join between two tables, converting one column to uppercase, filtering one table to only include rows where plotz is “farfegnugen”, and so on. But the order that these things happen is determined by the query engine and not the programmer.

Obviously, this does not include SQL supersets designed for writing stored procedures, like T-SQL and PL/SQL. Stored procedures are of course procedural for the most part.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [September 1, 2009, 11:25pm UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/42 "2009-09-01T23:25:57Z")

</div>

> [@friedo](#):
>
> I agree that UPDATE statements in SQL are essentially imperative.

Not at all. The query is still describing what to do, not how. The imperative approach would be to tell the computer to loop over every row, check all the necessary conditions, and then make an assignment if the record matches what you’re looking for.

(I don’t want to hijack, but it’s never been quite clear to me exactly what distinction allows SQL to be a programming language but not HTML. I don’t think there is any actual set of objective criteria that will include the languages most developers want, and exclude the languages they don’t.)

---

<div class="post-metadata">

**Author:** ![Sofis](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@Sofis](https://boards.straightdope.com/u/Sofis)\
**Post date:** [September 1, 2009, 11:49pm UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/43 "2009-09-01T23:49:48Z")

</div>

> [@ultrafilter](#):
>
> Not at all. The query is still describing what to do, not how. The imperative approach would be to tell the computer to loop over every row, check all the necessary conditions, and then make an assignment if the record matches what you’re looking for.

But telling the computer what to do, even if not how, is still imperative, no? I’d put the distinction between declarative and imperative mainly on whether one gives the computer orders or asks the computer questions (what is the value of this function? Is this statement satisfiable?).

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [September 2, 2009, 12:09am UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/44 "2009-09-02T00:09:59Z")

</div>

> [@Sofis](#):
>
> But telling the computer what to do, even if not how, is still imperative, no?

Not in the programming languages jargon. See [Wikipedia on imperative programming](http://en.wikipedia.org/wiki/Imperative_programming) for more than you ever cared to know.

---

<div class="post-metadata">

**Author:** ![Shot\_From\_Guns](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@Shot\_From\_Guns](https://boards.straightdope.com/u/Shot_From_Guns)\
**Post date:** [September 2, 2009, 4:47pm UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/45 "2009-09-02T16:47:51Z")

</div>

The book I wanted to recommend was \*Java Software Solutions \*by Lewis and Loftus. I used [the 3rd edition (2003)](http://www.amazon.com/Java-Software-Solutions-Foundations-CodeMate/dp/0321197194/), but it appears they’re now up to [the 6th edition (2008)](http://www.amazon.com/Java-Software-Solutions-Foundations-Program/dp/0321532058/). Hopefully the quality has remained consistent!

---

<div class="post-metadata">

**Author:** ![Alex\_Dubinsky](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Alex\_Dubinsky](https://boards.straightdope.com/u/Alex_Dubinsky)\
**Post date:** [September 2, 2009, 6:18pm UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/46 "2009-09-02T18:18:46Z")

</div>

> [@kombatminipig](#):
>
> Algorithms and datastructures are on the other hand universal concepts. A recursive function works the same in Java as in Haskell, it’s just implemented and compiled differently. The order a sorting algorithm is the same, no matter in what language it’s written in.

You’re talking about low-level code. Yeah, functions like these look the same in any non-ancient language. Modern languages have moved on to grappling with much larger, more complex issues. The solutions to _those_ issues will look quite different from language to language.

You may be a low-level program, and so am I, but high-level programming of GUIs, networks, multiprocessing, etc. is all a very different beast. You don’t need to have massive book learning about “algorithms” and “datastructures” for that, lol. Such low-level programming still undoubtedly matters, but it hasn’t been the mainstream since the 70s.

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [September 3, 2009, 2:36am UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/47 "2009-09-03T02:36:54Z")

</div>

> [@Alex\_Dubinsky](#):
>
> You’re talking about low-level code. Yeah, functions like these look the same in any non-ancient language. Modern languages have moved on to grappling with much larger, more complex issues. The solutions to _those_ issues will look quite different from language to language.

There was a time when C was a high-level language. Sigh.

> [@](#):
>
> You may be a low-level program, and so am I, but high-level programming of GUIs, networks, multiprocessing, etc. is all a very different beast. You don’t need to have massive book learning about “algorithms” and “datastructures” for that, lol. Such low-level programming still undoubtedly matters, but it hasn’t been the mainstream since the 70s.

I disagree completely. My main source of work is about as high-level as you can get, and I benefit daily from my basic CS knowledge about algorithmic complexity, optimization, and data structures. I may be writing code in a loosely-typed, OOP scripting language, but knowledge of the fundamentals informs my choices every day, almost always for the better.

---

<div class="post-metadata">

**Author:** ![Red\_Skeezix](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@Red\_Skeezix](https://boards.straightdope.com/u/Red_Skeezix)\
**Post date:** [September 3, 2009, 3:04am UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/48 "2009-09-03T03:04:44Z")

</div>

> [@Alex\_Dubinsky](#):
>
> You may be a low-level program, and so am I, but high-level programming of GUIs, networks, multiprocessing, etc. is all a very different beast. You don’t need to have massive book learning about “algorithms” and “datastructures” for that, lol. Such low-level programming still undoubtedly matters, but it hasn’t been the mainstream since the 70s.

Data structures and algorithms cannot be dismissed so easily, especially since making the correct choice between multiple data structures/algorithms that all do similar things often relies upon understanding how they work.

[QUOTE=Sofis]

But telling the computer what to do, even if not how, is still imperative, no? I’d put the distinction between declarative and imperative mainly on whether one gives the computer orders or asks the computer questions (what is the value of this function? Is this statement satisfiable?).

[/QUOTE]

Not really, declarative programming simplistically is a description of what the inputs and outputs are, and you let the computer figure out the middle. Imperative programming requires that the programmer specify how exactly to get from input to output.

Take for example the UPDATE statement, You are telling the computer that for some relation you want the values to change in accordance to a set of rules. The input is the relation and the output is the changed relation. The query processor however analyzes your rules and figures out the best(?) way to make it happen. It may select an index based or iterative based approach depending on the keys specified and the expected number of updated rows along with other decisions that it might make.

[QUOTE=ultrafilter]

(I don’t want to hijack, but it’s never been quite clear to me exactly what distinction allows SQL to be a programming language but not HTML. I don’t think there is any actual set of objective criteria that will include the languages most developers want, and exclude the languages they don’t.)

[/QUOTE]

The objective criteria is that SQL supports the generic programming constructs: sequence, selection/branching, iteration and subprocessing (functions or repeatable blocks, or in SQL’s case subqueries). AFAIK html does not, feel free to correct me, I’m not more than an HTML novice.

---

<div class="post-metadata">

**Author:** ![kombatminipig](https://avatars.discourse-cdn.com/v4/letter/k/b5ac83/32.png) [@kombatminipig](https://boards.straightdope.com/u/kombatminipig)\
**Post date:** [September 3, 2009, 8:21am UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/49 "2009-09-03T08:21:14Z")

</div>

> [@Alex\_Dubinsky](#):
>
> You’re talking about low-level code. Yeah, functions like these look the same in any non-ancient language. Modern languages have moved on to grappling with much larger, more complex issues. The solutions to _those_ issues will look quite different from language to language.
> 
> You may be a low-level program, and so am I, but high-level programming of GUIs, networks, multiprocessing, etc. is all a very different beast. You don’t need to have massive book learning about “algorithms” and “datastructures” for that, lol. Such low-level programming still undoubtedly matters, but it hasn’t been the mainstream since the 70s.

I don’t agree with you at all. I work with Java EE, which is about as high level as I care to get. I have daily use of knowing what datastructures to implement for best efficiency, not to mention theoretical knowledge of OO, encapsulation and programming patterns which aren’t language inherent. I spend a sizable portion of my day correcting poorly designed code by previous employees of my company who were less familiar with these concepts. The high technical debt of bad coding (which translates into real life debt in the end) is why I’m stressing the fact that simply learning a language is not enough.

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [September 3, 2009, 9:24am UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/50 "2009-09-03T09:24:46Z")

</div>

[QUOTE=Alex Dubinsky]

You may be a low-level program, and so am I, but high-level programming of GUIs, networks, multiprocessing, etc. is all a very different beast. You don’t need to have massive book learning about “algorithms” and “datastructures” for that, lol. Such low-level programming still undoubtedly matters, but it hasn’t been the mainstream since the 70s.

[/quote]

Completely wrong. Correct choice of datastructures is still critical, and will probably become even more so with the widespread move to parallel/multicore programming within the next few years. What works in the Java world, for instance, doesn’t work in the essentially stateless world of Haskell or ML (see Okasaki’s PhD thesis for details on functional datastructures), and that’s where we’re heading if we are going to make any sense at all out of all these cores that are appearing within processors.

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [September 3, 2009, 9:28am UTC](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063/51 "2009-09-03T09:28:39Z")

</div>

> [@friedo](#):
>
> Not all of them. Java doesn’t have tail-call optimization. 😛

Hardly any of them, in fact. Apart from tail-call optimisation to consider, there’s also Haskell’s lazy evaluation strategy (with its pros and cons) to consider:

```auto

ones :: [Int]
ones = 1 : ones

[a, b, c] = take 3 ones

```

Try doing that in Java without embroiling yourself in a thunk-filled nightmare.

ETA: to actually answer the OP, yes, it’s still worth learning Java. It’s widely used, and widely taught, and has a huge set of libraries.

[Previous page](https://boards.straightdope.com/t/is-it-worth-learning-java-and-whats-the-best-way-to-learn-it/508063.md?page=2)
