CODEX

Image for post
Image for post
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.


Image for post
Image for post
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.

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

If the search…


Image for post
Image for post
Photo by Adi Ulici on Unsplash

In a typical Java interface, you specify functions and procedures that classes must implement unless they’re abstract classes. You specify what the functions and procedures are called; the types of the parameters, if any; and you specify the return types for functions.

 @Override // ERROR…


CODEX

Image for post
Image for post

Writing documentation for your library or API can be a pain in the neck. Maybe you make a change to the API and you put off opening the separate file in which you’re writing the document. And then you never make the update, and next thing you know, people using your API are confused.


CODEX

Image for post
Image for post
Photo by freestocks on Unsplash

Java provides both arrays and lists. So does Scala. Java lists have many advantages over arrays. In Scala, the advantages of lists over arrays are even greater than in Java.

int[] numbers = {43, -7, 8, 21, 58};

There are a couple of other ways to do it, but they all involve the…


Image for post
Image for post
Photo by Yu (^^) on Unsplash

Usually, when I get a NullPointerException, it’s because I made some silly mistake in one of my Java source files that I can easily correct. Sometimes, though, it’s because some Java collections allow nulls to fall through the cracks, going undetected until they cause a problem.


Image for post
Image for post
Photo by Michael Dziedzic on Unsplash

On one of those question-and-answer websites, someone asked: What is the point of Java access modifiers if you can always just change them? It’s a question that crossed my mind when I was starting to learn Java years ago.


Image for post
Image for post
Photo by Markus Spiske on Unsplash

Using different combinations of access modifiers, Java programmers can create a system of very fine-grained access control in their Java projects. This is a good thing, it simplifies programming.

  • Public (public) means accessible from anywhere, subject…


Image for post
Image for post
Photo by Jason Pofahl on Unsplash

Access is an important element of encapsulation in object-oriented programming. For example: can an instance of a given class access the fields of an instance of another class? That depends on what access level that particular field has been designated with.


Image for post
Image for post
Photo by Gleren Meneghin on Unsplash

Almost every Java student is taught early on that Java has four access levels: class private (often just “private”), package private, protected and public.

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