This dramatic arrangement of chess pieces would never occur in an actual chess game. Photo by Felix Mittermeier on Unsplash

If you know abstract classes in Java, and you know a little bit about Scala syntax, you might think you already know how abstract classes work in Scala: pretty much the same as in Java, with a few minor differences.

And you’d be right. Scala abstract classes are a lot like Java abstract classes. The minor differences might trip you up occasionally, though. Or they might be pleasant surprises.

For this article, I’m going to assume that you indeed know about abstract classes in Java, so I won’t rehash the Java syntax, except to compare and contrast to Scala syntax.

Photo by Tim Evans on Unsplash

You can find lots of advice online about several different ways to keep “secrets” like API keys and passwords out of Git repositories, but I haven’t been able to find concrete examples for Java programs. This article will detail those concrete examples.

There are quite a few different ways to keep API keys out of Git repositories, each with its own pros and cons. Some articles explain the pros and cons, but without examples, it’s a little difficult to assess which way is the best way for your particular project.

Hopefully these examples I present here will help you figure…

Photo by Jongsun Lee on Unsplash

The three major integrated development environments (IDEs) all provide neat integration of JUnit, making it very easy to write and run JUnit tests without having to use the command line.

Of course they differ in how they provide that integration. In IntelliJ IDEA, each valid test gets a green play button allowing the test to run by itself, and another green play button to run all the tests in a test class.

There’s no way to run a single test by itself in NetBeans, except of course when a test class contains only a single test. …

CODEX

Schrödinger’s cat is not null. Photo by Myles Yu on Unsplash

Some Java programmers seem to be almost emotionally scarred by null pointer exceptions. It’s no wonder then that null safety is the most advertised Kotlin feature. Turns out that Scala had null safety from the beginning, and it goes a lot deeper than providing an optional or providing nullable types.

The thing is that Scala steers you to be more deliberate in what you declare as a variable and what you declare as a constant. Using IntelliJ to write Scala, you’ve probably seen the warning “var could be a val.”

Null is necessary sometimes. I don’t care about anyone’s regrets…

CODEX

Photo by Christin Hume on Unsplash

Completion suggestions are very helpful when programming Scala on an integrated development environment (IDE) like IntelliJ IDEA. And a REPL (read-eval-print-loop) like the local Scala REPL is a great way to quickly try out things that may or may not work.

Too bad there are no completion suggestions on the local Scala REPL. Actually, there are…

It requires pressing a key, specifically the Tab key. It’s kind of like completion with Ctrl- or Command-Space on Eclipse and NetBeans.

Well, it depends on your setup. Apparently it’s possible in some setups for the local Scala REPL to mostly work but lack…

An HTML file opened in Adobe Brackets 1.14 showing an image preview.
An HTML file opened in Adobe Brackets 1.14 showing an image preview.
An HTML file opened in Adobe Brackets 1.14 showing an image preview.

So I opened up Adobe Brackets to update a website’s source files, and it showed me this notification:

On September 1, 2021, Adobe will end support for Brackets. If you would like to continue using, maintaining and improving Brackets, you may fork the project on GitHub. Brackets users are encouraged to switch to Visual Studio Code for code editing.

The quotation might be inaccurate because as soon as I clicked the GitHub link and Microsoft Edge pulled up the GitHub repository for Brackets, the notification went away (I mostly use Firefox, but I generally don’t bother to make Firefox the…

Photo by Priscilla Du Preez on Unsplash

Object-oriented programming (OOP) is not the perfect way to model the world in a computer program. However, it is much easier than trying to understand the intricacies of a processor chip, a virtual machine, or even an operating system.

There is a lot of OOP jargon, but none of it should not discourage the student. Anything worth learning is going to have a lot of jargon associated with it. The teacher ought to explain the jargon as clearly as possible. I’ll come back to the jargon later on.

The basic idea of OOP is quite simple: you write classes that…

Photo by Giorgio Parravicini on Unsplash

Beginners in Java often ask for good projects with which to learn Java and the principles of object-oriented design. Games in general are often given as an answer. The program requirements for a game are easy to explain and the student can get immediate feedback on their program by playing the game.

Here I suggest Minesweeper on the command line in particular as a very good exercise for Java beginners to learn about object-oriented programming and the benefits of separating content from presentation.

Since the primary purpose of the famous Microsoft Windows Minesweeper game was to familiarize users with the…

CODEX

Photo by Fabrizio Verrecchia on Unsplash

The test-driven development (TDD) cycle consists of fail (red), pass (green) and refactor (blue). However, refactoring tends to get short shrift in most tutorials, it’s barely mentioned.

Or, when it’s mentioned, it feels unrealistic, especially if the intended program is of little practical value. Roman numeral arithmetic doesn’t have much practical value, but I do think it nevertheless provides a realistic example of one way that refactoring might arise in a real world project.

The problem is that sometimes, especially early on in the process, there’s no need to refactor anything. You ask yourself or your teammate whether there’s any…

Photo by Hedgehog Digital on Unsplash

I’m going to be upfront about this: I don’t understand regular expressions, or “regex” (sometimes “regexp”). I know they can be very powerful and very useful. Just don’t ask me to write one from scratch.

If you’re a Java programmer, you probably know about String’s indexOf() function. That one works great when you know the exact characters you’re looking for, not so much when you don’t.

Here’s a quick demonstration of indexOf() on String instances with not too many characters in the Scala REPL:

scala> "hamburger".indexOf("burger")
res0: Int = 3
scala> "hot dogs".indexOf("burger")
res1: Int = -1

If the search…

Alonso Del Arte

is a composer and photographer from Detroit, Michigan. He has been working on a Java program to display certain mathematical diagrams.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store