Java Platform (3 elements) aka Java Development Kit (JDK)
Standard library
Java Standard Edition (SE) APIs
Runtime environment
Java Virtual Machine (JVM) converts source code into the bytecode into the actual hardware.
Java’s principles
Advantages
Disadvantages
Java vs C#
Differences:
- C# is faster in terms of new features
- .NET is only recently made cross-platform
- C# is dominated by Microsoft (not as rich platform)
Java vs C/C++
Differences:
- C and C++ are unmanaged languages (you have to manage memory)
- More language features in C / C++
- C and C++ compile into the native machine code directly
Java vs Python
Differences:
- Python is interpreted language (there is no compilation step, so a lot of time is dedicated to the runtime part to run the code immediately line by line)
- In Python you don’t specify types (it’s NOT statically typed)
- In Python they don’t care much about compatibility like Java
- Python is good for small applications where performance is not a big issue
Java vs JavaScript
NodeJS took JavaScript from Web
Differences:
- No compilation step (interpreted language)
- Not statically typed
- Single-threaded (using all the cores in PC is problematic)
Desktop applications (using Java)
Desktop Java
Using GUI toolkit (AWT - Abstract Windowing Toolkit)
Swing (Pure Java GUI) –> allows you to choose how your layout will be, regardless of your platform
Java FX also exists where you can do drag and drop, supports 3D graphics…
Enterprise Java (Java EE –> Jakarta EE)
When you are in the enterprise, you need to select/create libraries to match your business applications.
Enterprise Java offers APIs for common enterprise application tasks, Java updates them.
Java in the Cloud
Uses Microframeworks such as Spring Boot.
Android and Java
Libraries
Utility Libraries
1. Spring Framework (dependency injection)
2. Google Guava (helps with IO libraries)
3. Apache Commons (Collections, CSV, IO)
4. Apache Log4J (Structured application logging)
Distributed Systems Libraries
1. Netty
2. Akka
3. RxJava
4. Apache Camel
Data-access Libraries
1. Java Database Connectivity (JDBC) (MySQL, Postgres, Oracle, H2)
Java-based Data Processing Libraries
1. Apache Hadoop (written in Java application) - it’s a distributed system for processing Big Data implemented in Java (good for batch processing)
2. Apache Spark (newer and good for streaming data)
3. DL4J - Deep Learning for Java (for NNs)
4. Datastores: Cassandra (written in Java to deal with databases), Neo4J, ElasticSearch, Hadoop Distributed File System (HDFS)
IDEs for Java
Eclipse (free)
IntelliJ (commercial)
Unit Testing
Testing the code unit by unit.
JUnit is a unit testing framework in Java.
Mocking tools help check the units inter-connections
Java Build Tools
Help automate the running of tests, modules etc.
They help identify parts that are repetitive.
Maven is a Build Tool.
Gradle is also a Build Tool (it’s incremental).
Alternatives to Java