13 ms·
Java for beginners
- collyw 9y agoI wish there was something like this for all languages. I know Java, but there are often occasions when something isn't working that I didn't write and don't have a clue about how to fix, but just need the basics to get started, and I can probably work it out by myself (e.g. our Wordpress site when the other two guys with experience in PHP leave). Programing syntax isn't usually the difficult part once you know two or three languages.
- rb808 9y ago> Java - the programming language that most seem to despise with great passion. Is that really true though? Anecdotally it seems lots of big firms are using Java8 even more often, as sidetracks to Go/Scala/C++* seem to be coming back.
- reading-at-work 9y agoBig firms like to use it, but most developers who work there probably don't; they just suck it up and do it for the paycheck. Source: am a developer at a big firm being forced to use Java.
- mathnode 9y agoForced? Like with thumbscrews?
- panzerboy 9y agoI'm writing Java all day long and I love it.
- Arcsech 9y agoFor what it's worth, I'm in the process of converting one of our components from JavaScript to Java because it is incredibly fragile, difficult to modify, and everyone hates working with it. Not everyone is forced to use Java. I really like Java actually, although we do make use of things like Lombok pretty heavily to reduce the boilerplate, enforce using inheritance very sparsely, and use immutable value types wherever possible (although sadly this is the part that gets ignored most often) - doing those things greatly improves the experience of using Java.
- al452 9y agoGoogle AutoValue is (for my money) a much better alternative to Lombok. Plus it's strongly opinionated towards immutability, big win.
- deleted 9y ago[deleted]
- SoulMan 9y agoEvery damn device runs on Java
- oblio 9y agoExcept for iOS ones :)
- pjmlp 9y agoDepends on who wrote the app and what tools they decided to use. http://robovm.mobidevelop.com/ http://robovm.mobidevelop.com/ https://software.intel.com/en-us/multi-os-engine https://software.intel.com/en-us/multi-os-engine http://gluonhq.com/products/mobile/ http://gluonhq.com/products/mobile/ https://www.codenameone.com/ https://www.codenameone.com/
- singularity2001 9y ago>> Java - the programming language that most seem to despise with great passion. > Is that really true though? one data point: yes
- linkmotif 9y agoThis is great. I've always envisioned something like "Java for Node developers", having learned Java coming from Node, with great reward and enjoyment. Java is a great and powerful ecosystem and even a fun language when not written in the absurd 2000s "enterprise" style.
- AndrewDucker 9y agoI keep wanting to like Java, but they insist on everything being done the hard way compared to C#. Sure, you want to provide a bunch of different readers, and let people put them together however you want. But compare the example there of using a BufferedReader in a loop to read in a file, and compare to the equivalent in C# - File.ReadLines (which gives you an IEnumerable<string>) or even File.ReadAllLines (which gives you a string[]). 99% of the time that's all you want, and yet Java makes you do the work yourself rather than just giving you a utility method.
- martinp 9y agoBad example. You can do this in Java 8: java.nio.file.Files.readAllLines(path) which returns List<String>.
- singularity2001 9y agoso they fix this one horribly convoluted use case, but most of the others are remaining?
- noobymatze 9y agoThere is a utility method `Files.readAllLines` [1] (even since Java 7) which gives you a List<String>. Since Java 8 there is even a lazy variant `Files.lines()` [2], which returns a Stream<String>. Though you gotta be a bit careful with that last one and be sure to close the underlying reader, as mentioned in the docs. I get your sentiment though. [1]: https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#readAllLines(java.nio.file.Path,%20java.nio.charset.Charset) https://docs.oracle.com/javase/7/docs/api/java/nio/file/File... [2]: https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#lines-java.nio.file.Path-java.nio.charset.Charset- https://docs.oracle.com/javase/8/docs/api/java/nio/file/File...
- bradleyjg 9y agoNot a bad intro, but java.io is an old crufty mess. Use guava's io instead: https://github.com/google/guava/wiki/IOExplained https://github.com/google/guava/wiki/IOExplained
- tootie 9y agoThe standard lib has java.nio which is a vast improvement. I usually throw in Apache Commons IO as well, but Guava is comparable.
- tootie 9y agoI don't know Java gets such a bad rap from the current generation. If I had my way (which I rarely do) I'd start any new server-side project on Java with Spring Boot. Everything about the stack is so fine-tuned and battle-tested. There's libs for everything under the sun. I can follow every stack trace even in a multi-threaded environment. Debuggers are extremely dependable. The IDEs are top notch. I know it's verbose and I prefer it that way. You spend more time reading code than writing and I'd rather see it all spelled out than encoded in punctuation marks. Otherwise, I'd go back to Perl.
- striking 9y agoIs there a tutorial one could follow to try this out? You've got me interested but I don't know where to go next.
- fma 9y agoSpring Boot project has an intro project right on their homepage. https://projects.spring.io/spring-boot/ https://projects.spring.io/spring-boot/ You can get a running webapp within minutes. The caution is, you would have limited information on what's going on in the background. Great for those who already know Spring and its inner workings because it's convenient - but could be detrimental on a beginner if you don't take the effort later to learn the inner workings.
- striking 9y agoThis is super helpful. Shows an example of the framework right up front, and has detailed explanations linked. Thanks.
- happy-go-lucky 9y agoJava Programming Basics: https://www.udacity.com/course/java-programming-basics--ud282 https://www.udacity.com/course/java-programming-basics--ud28...
- arethuza 9y agoI was very enthusiastic about Java from 1995 to about 2000 or so - then it seemed to become dominated by an "enterprise" outlook and rampant over-abstractionism. Java is permanently associated in my mind with hammer factories: http://discuss.joelonsoftware.com/default.asp?joel.3.219431.12 http://discuss.joelonsoftware.com/default.asp?joel.3.219431....
- ktzar 9y ago"Properly commenting code is so often overlooked when developing software and it is a damn shame". I'd change that to, "commenting code that is self-explanatory is so often overused when developing software and it is a damn shame" In the very same article, there's a function with the following JavaDoc description "A simple add implementation that performs addition on two integer values". Nothing I can't get from actually "knowing how to read code".
- Retra 9y agoExcept by reading that comment, you can tell if the function was implemented correctly or not.
- ben-schaaf 9y agoUntil your requirements change and someone forgets to update the comment. Now you don't know whether you have a bug and/or bad documentation.
- Retra 9y agoThat should be an easy checkbox for any code reviews you do. If you changed the function, why didn't you change the comment?
- adamors 9y agoThat's what unit tests are for.
- supremesaboteur 9y agoWould recommend Oracle's official Java trails : https://docs.oracle.com/javase/tutorial/ https://docs.oracle.com/javase/tutorial/
- NoWizards 9y agoi really hope this language will disappear
- StyloBill 9y agoYou can keep on hoping, but you're in for a big disappointment.
- wffurr 9y agoJava is Blub. http://www.paulgraham.com/avg.html http://www.paulgraham.com/avg.html