jeanne and scott’s first book – with picture

The book has either been out for three months or six weeks depending on how you count. (The e-book was released earlier). A couple weeks ago, Scott and I took a picture with the book:

scott-book

 

We’ve also learned that Amazon has a page called authorcentral.amazon.com which shows you “real time” book stats:

stats

 

Well real time with three disclaimers:

  1. It’s updated weekly.
  2. It only includes US sales.
  3. It only includes printed book sales.

While it is bizarre to me that Amazon doesn’t include Kindle sales, it is cool seeing the map. The NY area has the most sales which isn’t surprising. Scott and I both live in the tri-state area and have therefore told the most people there. DC and Dallas were second and third.

playing with scratch

Scratch is an intro programming language for kids. (Like Logo was, but way better). When I saw edx was offering an Intro to Scratch course, I decided to take that opportunity to learn it. It’s cute and a great starting point for programming. It offers the ability to write a really simple program. But it also lets you learn about lists and event handling.

For my final project for the course, I wrote a two player game of tic tac toe. Here’s what jumped out me when doing the project.

Components used

  1. Multiple sprites and event handling (broadcast/wait)
  2. Key and mouse listeners
  3. Functions (custom blocks)
  4. Logic (loops/conditionals)
  5. Lists
  6. Comments

What I missed

As a programmer used to full fledged (non-simplified) programming languages and environments, there are a few things I missed.

  1. Real 2D arrays. I used a string in a 1D array and getting the character at each position.
  2. Grouping parens. I wanted to write something equivalent to (a==b and b==c) or (d==e and e=f)). While this possible to do in Scratch, it uses the layering of blocks rather than parens so is hard to read. I wound up splitting into two if statements.
  3. Local variables. There are “sprite only” variables, but they still clutter up the namespace and make it hard to find the variable you need at a given point.
  4. elsif/elseif. Yes, you can nest if/else statements. But harder to read.
  5. I didn’t work on the program for two weeks and went back to it. I really wanted “search” functionality to find uses of a variable or where a custom block was defined.
  6. I miss having rollback/history for changes. When the program “used to work” and then doesn’t, it’s hard to figure out what you accidentally drag and dropped.

 

Other interesting points

  1. Scratch uses 1 based indexes. Makes sense for a first language to break with the odd tradition practically ever other language uses. But feels weird.
  2. There is no distinction between character and numeric types. This meant I could get a character out of a string and use it as a loop index.
  3. Regular mode and turbo mode allows you to control the speed the sprites draw. This is useful when drawing things like circles. When coding, turbo mode is enabled with Edit > Turbo Mode. When in the play view, it is enabled by holding shift when pressing the green flag to start. I wish there were a way to either “save” with turbo mode or turn turbo mode on in the code.
  4. There are blocks for length of on list and and operator/string. Calling the wrong length block on a list doesn’t fail, but does return unexpected data.

Refactoring?

  1. I have some duplication in drawO vs draw X and if statements when drawing the grid. I could put in variable but didn’t feel like it was clearer that way. Similarly in calculating if the a player won.
  2. I also have duplication in “when I receive move” if statements. I got lazy when drawing the line.

 

jeanne’s java 8 upgrade exam experience

On Friday, I took the Java 8 Upgrade exam beta.

As I did with the OCPJP 7 and OCAJP 8I’m going to take a stab at guessing my score. I’ll edit this post when I know my actual score.  I think I got between 75% and 85%.
I got a 66% on the upgrade exam, but an 88% on the full exam which I more prepared for. (passing is 65% so I barely passed) I think I was overconfident. As I gained more experience (after the exam) both through using Java 8 and writing the chapters for our OCP book, I realized the topic was far deeper than I realized when studying for the exam. Also, I spent a lot of time studying Nashorn which I didn’t know at all before the objectives came out. Didn’t get any questions wrong on that. I also had mis-read the date/time objectives and didn’t know a good number of the APIs when taking the exam. Know them now!

How did I study?

Topic How studied
Inner classes Re-read that Advanced Class design chapter in the draft version of our OCP book. Also re-read the draft of our section on effectively final
Lambdas/filtering/collections/streams Re-read the parts of the functional programming chapter I had drafted along with my outline for the rest. (This is a big chapter and it isn’t finished yet. We do have the key points listed though which shows what to study/look for)My favorite book for learning these topics in the first place is Java 8 for the Really Impatient. Also Java 8 New Features is good. I also used the lambda tutorial to learn from originally.I’ve been doing a good bit of functional programming in Groovy in addition to learning lambdas deeply for Java. I felt prepared for this part of the exam. Which is good because it is a large percentage of the exam.
Static/default methods on interfaces Read the sections on interfaces in our OCA book and re-did the mock questions.
Java 8 Date/Time API Read the sections on Java 8 Dates in our OCA book and re-did the mock questions.Note: I completely missed the fact that the upgrade exam covers ZonedDateTime (and daylight savings time.) This is not on the OCA and therefore not in our OCA book. If you aren’t from the US, I recommend remembering that in the US, we move the clocks forward one hour (there is no 2-2:59am) on one day in the spring and backward one hour (2am occurs twice) on one day in the fall.I hope they don’t put this on the OCP exam. I don’t think something that requires this knowledge of how United States daylight savings time works belongs on the exam.
Nashorn Unlike lambdas, my experience with Nashorn is that I read a chapter on it in Java 8 for the Really Impatient. When I found out it was on the upgrade exam, I started learning it more deeply. I didn’t think they were going to put it on the exam. It’s not a major part of the language.Anyway, I wrote up the key points for the chapter before taking the exam. This turned out to be good preparation.I have coded in JavaScript. Which helped with one question, but wasn’t a major contributor to getting these questions right on the exam.I also used the API from the tutorial along with the shell tutorial. (the shell scripting parts aren’t on the exam – the objectives don’t say they are, but I was skeptical. Glad to see they scoped this down at least).

And of course, I wrote a bunch of practice code.

Test day

The objectives list the beta as being 150-225 minutes. (quite the range.) That’s 2.5 to 3.75 hours. My exam was 3 hours. (I’m glad I didn’t get an even longer one. Three hours is a long time to sit!) In my three hour window I got 126 questions to answer. It took me two hours to go through my first pass of answering each question. I had about 20 to go back to. One good thing about having so many questions is that sometimes a fact you don’t remember is answered in another question. That happened for a few of mine. After I finished going back to those 20, I called it done. I didn’t review the others because I was tired. Did I mention three hours is a long time?

When I took the OCAJP 8 beta, there was new functionality where you could right click an answer to cross it out (strikethrough) in the exam itself. It didn’t work at that point, but it does now. I really like this feature. It was nice to be able to mark off answers as I read. This also meant I had less to write down on the markerboard during the exam.

I even used the cross out feature for some questions that I wasn’t going back to. if I was thinking about “process of elimination” I used it. Or even if the answers were long. Or I had to choose the best two or three answers. It was nice to have less to remember in my head!