Computing Thoughts

Bruce Eckel's Programming Blog

Sep 29, 2022 - 11 minute read

Why Are There Functions?

Returning from giving my Polymorphism Unbound presentation at StrangeLoop (not yet available on YouTube, but all the examples and presentation slides are on Github), I found myself dissatisfied. Part of this was certainly my failure to cram a 2-hour presentation into 40 minutes (after cutting it down from a day-long, workshop-length size). The bigger issue was my inability to answer the essential question at the end of the presentation: why are we writing polymorphic functions?

May 11, 2022 - 15 minute read

Misunderstanding Python Class Attributes

I was attempting to assist on an open-source project when I was stopped short by this (names have been changed): class DataPoint: measurement1 = None measurement2 = None measurement3 = None DataPoint was later used like this: d = DataPoint() d.measurement1 = 100 d.measurement2 = 200 d.measurement3 = 300 Why give names and initialization values to class attributes, then when you make an object, immediately create and initialize instance variables with the same names as the class attributes?

Feb 4, 2021 - 6 minute read

Java Object Equivalence

This is an update to the subsection “Testing Object Equivalence” in the “Operators” chapter of On Java 8. This will appear in the book in its next update. The relational operators == and != work with all objects, but their results can be confusing: // operators/ public class Equivalence { static void show(String desc, Integer n1, Integer n2) { System.out.println(desc + ":"); System.out.printf( "%d==%d %b %b%n", n1, n2, n1 == n2, n1.

Jan 2, 2021 - 16 minute read

The Problem with Gradle

Or: How to Remain Sane when Approaching Gradle (with apologies to Hans Dockter). (James Ward and I go into more detail about this article in the Happy Path Programming Podcast). I started using make in the 80’s. When I wrote Thinking in C++, I created a tool I called makebuilder which analyzed the examples extracted from the book and generated an appropriate makefile. make is a dedicated tool that only cares about dependencies and actions, so it is reasonably approachable.

Nov 22, 2020 - 7 minute read

Python Extensions with Rust and Go

The goal of a developer retreat is to stop what you are doing for awhile and explore something new. This usually requires a shift in mindset, and the biggest shift is to suspend the focus around productivity and urgency. It’s important to give up the idea that “we must accomplish something in an amount of time.” Only with the sigh of relief that comes from liberating yourself from goals is your brain allowed to float to the most interesting places.

Jul 30, 2020 - 4 minute read

We Haven't Invented Zero Yet

I am the author, with Svetlana Isakova, of Atomic Kotlin. I suspect most people currently alive were introduced to the concept of zero quite early in their development—early enough that they internalized it as a foundational principle and don’t ask questions about it. In addition, many people probably know that zero was invented after the original number systems. The ancient Greeks didn’t have a zero, and it puzzled them: “How can nothing be something?