Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Tuesday, May 1, 2018

The Command Line as a Gaming Platform: ANSI Graphics and Midi Music

Introduction


Last September (2017) I got the bright idea that it would be fun to make a game for the command line. I wanted it to be graphical, but only using basic text characters (charmap is my good friend).  I messed around with it a bit in .NET and posted some experimental code to GitHub, and got as far as generating box drawings based on text files:


Tuesday, January 16, 2018

"Effective Java" book outline

Effective Java was written by Joshua Bloch in 2001, and the second edition released in 2009 shortly after the release of Java 6.  I received a copy of the second edition from my manager as recommended reading.  While it was sometimes a little dated, it still made for easy reading, and it felt like most of the recommendations would still be pretty relevant.  As it happens, there is now a third edition that covers Java 7, 8, and 9 which may be worth checking out...

Overall I was impressed with the advice given in the book.  In order to make better practical use of it, I wanted to create a basic "outline" view that I could easily find and scan, making reference back to the book if needed.  That is really all this post is.  I thought about adding "notes"... either to each item or to each section, but they just cluttered it up.  I want this to be more a quick cheat sheet of the guidelines, not a full blown Readers Digest edition of the book...


Tuesday, April 25, 2017

MIT 6.005 - Software Construction (edX)

The resources for MIT's "Software Construction" class are distributed between several disparate sources.  There is an entry for 6.005 on the MIT Open Courseware page, where it is called "Elements of Software Construction", and there are two classes on edX: 6.005.1x "Software Construction in Java" and 6.005.2x "Advanced Software Construction in Java".

I'm hoping that working through this class will sharpen my understanding of general software engineering concepts.  The emphasis of the class is writing bug free code that is easy to understand and easy to change, which is certainly something you can never be too good at, am I right?

Thursday, April 20, 2017

Instantiating an object in Java without calling a constructor

The Scenario


This isn't a cliche...


I was working on a Java project that talks to a web service with a custom "Client" class that was written internally.  In my project, the client is pulled in from a hosted maven repo as a dependency, so I didn't have access to the source (at least not from this project).  I'm trying to be better about writing characterization tests for existing code before I go in and change anything (if nothing else it's a good way to feel out the code). But I had a problem...

The Client has a single constructor, which takes an endpoint, a username, and a password. Calling this constructor tries to connect to the endpoint (and crashes if it fails).  Because this was the only defined constructor, subclassing wasn't going to help me.  It doesn't implement an interface, so that avenue was also closed down.

So there was no obvious way for me to create a test double to pass in to the code I was actually interested in testing.  How in the hell was I going to get around this???

Friday, March 17, 2017

Making assertions with jUnit against log4j console output


I will open by saying that making assertions against your log output is probably a bad idea.  Probably violates every rule of good testing.  That said, I found myself writing characterization tests against some legacy code and I wanted to make sure I didn't break the logging.  So I decided to write some flakey, brittle unit tests.  It was several hours of pain, and I figured it would be a good idea to document my pain so you can avoid some of it (hopefully by not following in my footsteps at all... sigh)

Wednesday, January 11, 2017

My Google Interview Journey

The Hook


It's mid November and I'm minding my own business, when out of the blue I get a message on LinkedIn.  It's a technical recruiter from Google, we'll call her "K" (you know, like in The English Patient), and she says she was impressed by my HackerRank badge for Algorithms.  She wants to have a chat and learn a little bit about my background, she says.  Of course this blew my mind, in a sort of "glitter and confetti shooting out my ears" sort of way.  I've had recruiters hit my up on LinkedIn before, but this was Google!  I allowed myself to glow in it for a little while, but I tried to keep myself in check too.  At this stage, it was just one phone call with a recruiter.

Saturday, July 16, 2016

Java Multithreading in Google AppEngine

I'm currently working on a security app using Google AppScript.  One bit of functionality the product owner wanted implemented was checking ip addresses against a blacklist.  The original idea was for a self generated blacklist, but before I started implementing that, I wanted to see if there were any blacklists out in the wild that I could leverage.  While there are many blacklists out there (a few of the big ones are on this wikipedia page "Comparison of DNS blacklists"), almost without exception they use a specially formatted DNS query to get results.  This is a huge dealbreaker for a JavaScript app, as there is no way to do a DNS query in AppScript (yeah, node.js does it, but alas, not using node, so...).  So I made the decision to stand up my own Java REST endpoint in AppEngine.

Thursday, February 25, 2016

Using Maven and Google Plugin for Eclipse together in harmony

So, this post is mostly about documenting, for myself, how to get Eclipse and Maven set up correctly for my current project, but I think there might also be some bits of useful wisdom for other devs who might be working with similar circumstances.  The basic, 30k foot look at my problem is something like this:


   I have a Google Web Toolkit (GWT) project that is to run on Google App Engine (GAE).  How do I use Maven to manage dependencies, while still maintaining the functionality that the Google Plugin for Eclipse (GPE) gives me?

Sunday, December 6, 2015

Berkeley CS61B - Data structures (Projects)

Back in May I worked through the Data Structures class through UC Berkeley.  I got the homeworks finished, but I put off working on the projects right away.  In August I got projects 0 and 1 finished.
In late October I finally got around to finishing Project 2.  Finally, in early December I finished Project 3 (I got sidetracked working through MIT's Intro to Algorithms class... and doing like, a billion HackerRank challenges lol)

Wednesday, June 10, 2015

CBTNuggets App Engine series

As part of my quest to become a cloud developer extraordinaire, I've been trying a number of different learning resources for Google App Engine.  I had a pretty positive experience with the Udacity offering.  The CBTNuggets series on GAE, however, I found a bit disappointing.  Whereas Udacity aims to cover GAE in about a week, the CBT course is about 8 hours.  Though really it's more like 5 hours because the demos are all done twice, once in Python and once in Java.

Friday, May 22, 2015

Berkeley CS61B - Data structures

I hadn't ventured into the open courseware realm for a while, and I've wanted to get a bit of formal education on data structures and algorithms for a while, so I finally took the plunge a couple weeks ago and started 61B.  For quick reference, here are the relevant locations:

Course Website
Course Lectures
Big O Cheatsheet
Wikipeadia articles on data structures.

Wednesday, May 20, 2015

Udacity Course: Developing Scalable Apps in Java

My new position focuses on cloud development, with an emphasis on Google App Engine.  I wanted to get up and running quickly, so I worked through this course from Udacity.  Prior to this course, I'd only worked on one other App Engine project, which was basically an expansion on the Google Backend API Walkthrough.  I'd previously used the Google Plugin for Eclipse, however this project uses the App Engine maven plugin, so that was different.  Overall I thought it was a good course.  Naturally, nothing involving Eclipse can go smoothly the first time, but after a couple hiccups, I was off and running.

Friday, March 6, 2015

AppEngine, Eclipse, Google API's ... and grey hairs

This is another straight forward "lessons learned" kind of post.  The last week I've been working on a side project at work for the "Innovation" team.  We're tasked with creating a paperless timecard system for the agency, and I've taken on the piece that interfaces with the Google APIs to save the timecards.