“The first law of software quality.” From this Twitter page.
As a quick note, if you want to embed a Scala source code example in your Scaladoc comments, just put the source code block in between
}}} characters in your comments, as shown in this example:
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 14.2, “How to paste and load blocks of code in the Scala REPL.”
You want to experiment with some code in the Scala REPL, and typing it in or trying to paste it into the REPL won’t work.
Personally, I like helpful comments in code (such as to explain a complex algorithm in a function), but I understand that they get as out of date as this “Missing” sign. Image from this Twitter page.
This is a little unusual for me, but I'm putting the following code here so I can remember how I implement a
ViewPager in my current Android application. I want to put this code out here in its current state before it gets more complicated. In fact, I only wish I had copied it out here earlier, before I made it as complicated as it is.
The only things that are important to know are:
Here’s a quick example of how to access an Android
MenuItem in a Java
Fragment class (i.e., in your Java code).
Given a menu named res/menu/menu_landing_page.xml defined like this:
I’m just working through some examples in an excellent Android programming book (Android Programming: The Big Nerd Ranch Guide), and ran across this old Java code. I know things are better in Java 8, but this reminds me of how much goodness Scala has brought into my programming life.
“I hate reading other people’s code.” (This cartoon is making the rounds again.)