Posts

Showing posts with the label Java-Python-Devs

Tooling: IntelliJ, jshell, and the Build Pipeline

1. The edit

The JVM Ecosystem: Maven Central, Spring, and What's Standard

You know the Python landscape by heart: pip installs from PyPI, venv isolates environments, the standard library covers files/dates/JSON/HTTP, and when you need a web service you reach for Django or Flask, pytest for tests, and the logging module when things get serious. None of that knowledge transfers name-for-name — but every one of those needs has a Java answer, and this post is the map. Here's the honest version of the map, in one paragraph. Java's standard library ships with the JDK — collections, file I/O, dates, and even an HTTP client come free with every install. Maven Central is the PyPI of the JVM : a public artifact repository where every library has exact coordinates, and you download them with a build tool instead of pip . The build tool is usually Maven or Gradle (think pip + setuptools / pyproject.toml combined). A JAR is the distribution format — a zip with a manifest, roughly a wheel. And Spring Boot is the closest thing to Django: an opiniona...

Types, Generics & Nullability

Post 1 changed how you think about Java values: everything is passed by value, == asks "same object?", .equals() asks "same value?", types are checked at compile time, and String is immutable. This post is about the type system itself — the machinery behind those rules. For a Python developer, Java's type system is the biggest daily difference you'll feel, and it will either read as bureaucracy or as a second pair of eyes. Which one depends on understanding what it's actually doing. The honest frame for this whole post: every code block below ran on JDK 21 on my machine, and every output block is the real output, pasted verbatim. Python comparisons ran on Python 3.12. Where I show a compile error, I show the real javac message. Nothing here is "trust me." 1. Two worlds: primitives vs wrapper classes In Python, every value is an object — 42 is a full int object, and Python integers have arbitrary precision. Java splits its world...

From Python to Java: The Mental-Model Shift

You already know how to program. That's the good news and the trap: Java will feel familiar enough that you'll read your Python instincts straight into it — and wrong enough in ten specific places that those instincts will quietly betray you. This post is about those ten places. Not syntax — you can look up syntax. The mental models : what a variable is, what == means, when an error is allowed to exist, who cleans up your objects. Every example below ran for real: JDK 21 (Temurin 21.0.12.1) and Python 3.12.3, outputs pasted from actual runs, no invented numbers. The lab sources live alongside this post so you can re-run anything that surprises you — and a few things should. Start with the single biggest remap. In Python, a name is a sticky note slapped onto an object; the object carries the type, the name carries nothing. In Java, a variable is a typed slot: for primitives the value lives in the slot, for objects the slot holds a reference to a heap object — and the ty...