Java Refreshment Series — Prelude

A journey of languages

Table of Content:

  • Part 1: What is Java; Is Java an interpreting language; Exception vs Error; Different types of references; String vs StringBuffer vs StringBuilder.
  • Part 2: Java Reflection; Int vs Integer; Vector vs ArrayList vs LinkedList; HashTable vs HashMap vs TreeMap; ConcurrentMap;
  • Part 3: Java IO; Copy files in Java; Interface vs Abstract Class; Design Patterns; Synchronized vs Reentrant Lock;
  • Part 4: How @synchronized works; Java thread; Debug deadlock; Java Concurrency Packages; ConcurrentLinkedQueue vs LinkedBlockingQueue;
  • Part 5: Java Thread Pool; CAS; Java Class Loader;
  • Part 6: Java Runtime Library; Java Memory Model; Debug JVM memory; Java GC choices; Tune GC; Java Memory Model Rules; Java in Docker;
  • Part 7: Java Security; Debug Java Slowness; Java Lambda; JVM Optimization; MySQL isolation levels.

2. JVM Series

Motivation!

Honestly speaking, in terms of personal site building, Python would be my buddy since you can bring a site online with 1/10 of the work of doing the same in other languages. It’s your best friend to iterate fast. However, I haven’t figured out a way to scale Python project beyond 3 engineers effectively. With more than 3 engineers, things start to go south — random exceptions from others’ function calls, missing documentation makes a function a unsolvable puzzle(no doc is very bad itself, but Python makes the consequence even worse), no compile time type check brings you different surprises each time you deploy your code to cloud.

For production usages, beyond sporadic Python shops like Pinterest, Instagram and others, companies use a variety of languages. Facebook uses PHP for mid tier services, well, to be more accurate, a dialect of PHP — Hack, I know Facebook makes Hack a great variant of PHP, but I have no love for PHP. Google and Facebook also use C++ for their backend services, I tried a couple times to read more about C++ 11, the 1200+ pages The C++ Programming Language from its very author brutally turned me away. It seems like a magical and overwhelming beast to me, it is capable of doing anything with super complicated syntaxes with low latency. What about other languages in Internet companies? I heard some folks migrated their server code from Java to Go and then migrated back, some folks migrated from Java to Scala and also migrated back. Personally, in terms of different programming paradigms, I love functional programming the most — after I wrote a compile with OCaml for merely 600 lines. Functional programming is the most natural way of writing code, however, 1000 software engineers have 1000 different natures, so I won’t say it fits into large companies.

What else? Java! Java was accused of verbosity, speed, GC, etc.. still, Java is a most prevalent server side language and its verbosity brings some senses of clarity in multi-team production environment. Java, with great security features, super mature ecosystems, awesome IDE support (this is VERY important), good performance (with well tuned settings), portability across platforms, easy to learn makes it standout.

Well, beyond what was describe above, most importantly, most of code in my company are in Java and I am working with Java nowadays day and night.

Sounds like a reasonable investment to know more about Java. Wait, isn’t Java a simple language, what else do you need to learn once you know the syntaxes? Yes, it is very easy to use, I know almost nothing about Java but I can still write Java code day and night; most people do coding interviews with Java (or Python) even they don’t know what JIT is. Nonetheless, it is very hard to master. Byte code, GC, JVM, a lot to explore to make your Java code performant and elegant, no mention the tons of common JDK libraries I need to know.

This series would record my Java journey from 0.1/10 to hopefully 10/10 :)

Reference

hacker, lifetime learner