A suggestion for those who create projects for open source

Please include a tutorial on how to use your product.

An example of this:

I saw a talk on FiloDB. It sounds like an interesting time series collection database. The technical challenges sound interesting and the architecture sounds like its sensible. However, when going to the project, there’s nothing there that will get me off the ground and working with it quickly.

TL;DR Write documentation in a manner which it helps to lead the user to use your product/project successfully.

Refactoring the Monolith (A CJUG Lightning Talk)

A few weeks ago I did a talk on refactoring monoliths for the Chicago Java Users Group. It was a short lightning talk about some of the alternatives that developers have when refactoring large monoliths. In the talk I went over how the problem came to be, and what some of the alternatives were and their pluses/minuses.

The slides to the talk can be found here:

https://www.slideshare.net/StevenHicks6/refactoring-the-monolith

Why did I do this talk?

This talk was mostly done due to my observation of the cargo-cult reaction to monoliths and reactoring. Yes, the monolith is pretty big and bulky, however it does get the job done. However, the popular opinion about what to do with them is to make a ton of microservices. In the long run, it just turns one monolith into a lot of noisy monoliths.

What did I learn?

The video of the talk hasn’t come out yet, however I feel like I had 2 things that could have been:

  1. Time the talk better. I felt influenced by the prior presenters to rush to finish in an unstated time limit.
  2. More practice could have made this talk smoother.

What have I been learning lately/What Have I been reading lately (March/April 2018)

It’s been a while since I’ve done a blog post like this.

However, I’ve been busy and I have a few things to show for it:

Exciting Meetups Attended:

Projects That I’ve been working on:

    • Scala99
    • Temperature Sensor Data Generator
      • This is a utility project that will generate a series of data from sensors that closely resemble a day’s change in temperature.
      • This is to generate a large enough dataset to really demonstrate large-scale distributed processing
    • CQRS Framework
      • An extendable framework used to track events throughout a data object’s lifespan.
      • Using Shapeless
      • Currently on hold until I can fully wrap my head arround Shapeless
    • Sample Akka-HTTP Based Application for Inventory Pricing
      • This is a sample Akka HTTP Based application that responds to Time based requests for inventory.
      • Akka HTTP was a bit irritating to setup the routing.

Technologies I’m Learning Right Now

  • Apache Spark
  • The Play Web Framework
  • Amazon RedShift
  • Shapeless

Books Read:

Things I’ve Mastered/Dealt with Cooking

  • Sous Viding
    • Experimented with Octopus (They were a bit too small to get right, and this was done with Sous Viding)
    • The Perfect Steak and Crust on the outside
    • Dry Aging Ribeye Steaks
  • Keto
    • Lemon Bars
    • Tirmasu Fudge
    • I’m very close to making a stock

Books I’m Currently Reading

Topics I want to learn/read about

  • Optaplanner
  • More with IOT
    • I had a chance to work with a Seed WIO wifi based IOT board
    • I bought a Nano PI from FriendlyElec.
  • Cassandra
  • ElasticSearch
  • Going further indepth with Kafka
  • Akka Typed

 

Tips on Traveling to Hong Kong

Recently, I took a trip to Hong Kong and there were a few things I would have liked to know about before going:

  1. 1The MTR (Main trains) are fantastic, and fairly cheap. The Hong Kong dollar is about about $7 HKD to 1 USD and many of the rides that you’ll need are around $15HKD each. What you’ll need to do is to get an Octopus card (It’s a value store system) at the airport after you leave customs. (Along with a SIM card) Make sure to put at least $250 on the card so that you can leave the airport express train.
  2. You have to wave down the bus that you intend to get on.
  3. Most places accept Visa cards, this is good, but make sure to bring cash.
  4. The food in Hong Kong is fantastic, and comparatively cheap. (You can get out of Bread Street by Gordon Ramsey paying less than 100$ USD.)
  5. See the Tian Tan Buddha on top of Nong Ping. Also, if you have the money, get the clear bottom cable cars. They tend to have less of a line to get on.
  6. Go to the markets and haggle. Never use your CC and bring a diverse amount of bills. Most of the places will give you a price and another “special price.” Always make sure that you counter, and meet in the middle. If you’re looking to buy multiple items, settle on a low single unit price, then ask for a discount for multiple. See the Youtuber Colin Abroadcast for examples on some of the bargaining.
  7. Stay in Kowloon. There’s no need to be in Hong Kong City. The train runs all night and it’s very fast.
  8. Connecting through the airport: The airport is a pretty efficient airport for transferring you though. Getting through security shouldn’t be a problem. (There is a special area for transiting and you don’t have to go through customs if you’re flying from one country to another in the airport).
  9. See the Peak Tram/Victorias Peak. But check before hand on the best times to go. This can be a very busy place.

 

You can Either Try or not (Scala: Try, Either)

One of the things that I recently discovered in Scala is Try and Ether statements. They’re extremely cool to work with!

To Try

In the order I learned about them, I’ll explain what a Try is. It is a method that wraps the incoming and handles all exceptions that come out of it. If an exception comes out of it the value that is represented by the Try will be returned as Failure([exceptionvalue]). If the result was a success then the object Success([result value]) is returned. Pretty cool right? This means you don’t have to setup a Try/Catch everytime that you have an exception thrown. Combined with pattern matching, this will allow for you to simplify your statements that have Try/Catches. Even better: Try:Success is an option.

An example of this is:

class demonstration {
  def getGoogleResults(keyword: String) = {
    var googleClientResult = null
    try {
      val googleClient = new GoogleClient(authKeys)
      googleClientResult = googleClient.query(keyword)
    } catch (exception: Exception) {
      System.err.println(s"Error: $exception")
      throw exception
    }
    System.out.println(s"It found   $ {googleClientResult.size}")
  }

  def getBetterGoogleResults(keyword:String) = {
    val googleClient = new GoogleClient(authKeys)
    val googleResults = Try(googleClient.query(keyword))

    googleResults.success.map(v => System.out.println(s"It found ${v.size}")
      googleResults.failure.map(e => {
      System.err.println(s"Error $e")
      throw e
    })
  }
}

The getGoogleResults method shows the Java style of doing this. The getBetterGoogleResults shows the shorter functional try way of going about this. It reduced a bit of boilerplate and made the code a lot easier to read. Something to note: success and failure coming off of the Try object are Options.

How does this work? (Either it does or it doesn’t)

Try is a case of a language feature called Either in Scala. Either is a way to return two possible non-common objects. In other words, you can return either a String or an Integer from a method. Either uses generics to type each case (the left or the right), and it handles the direction of what object that comes back.

Since there is a possibility of different types, it’s not possible to have a single method to get the results of the try. (That would be possible in Groovy!) You have to work with both possible types (as we showed with the success and failure responses in the example above). Luckily, the left and right values coming off of the Ether are Options, which makes this less painful.

Going back to the Try vs. Either reference: A try is and Either object defined as having a Success and Failure object. The other difference is that Try handles exceptions, and it has special names for success and failure added to the class.

References

Some of the things that I’ve been up to in the last few months (March-June)

Some of the things that I’ve been up to in the last few months:

  1. I saw Metallica for the first time a few days ago! That was pretty awesome. I would say that was either my third or second best concert that I’ve ever seen. The first best was Rammstein at the Open Air Festival last year.
  2. I learned about Try/Ether in Scala. That’s pretty awesome. Expect a blog post coming out about that
  3. I started doing the X Effect challenge for 50 squats a day over 49 days. So far I’m 40 days in and I’ve only missed 3 days. That’s pretty awesome.
  4. Wearing sunglasses when it’s sunny is a good idea. It helps to prevent your eyes from straining. I feel like I should have learned this a long time ago. Doh.
  5. I’ve been experimenting with turning my phone off while at work and during social events. This has helped my concentration and focus immensely. Although, it has been a learning experience with quick attempts to check the phone.
  6. I’ve taken a hiatus from side projects for the last 4 months. It’s been nice to have a life back and not worry about getting a huge project done.
  7. My parents came up to Chicago and we visited Davenport, IA. We got to see the Mississipi River. 
  8. I got a fantastic new camera: the Lumix LX10. I love the thing. It’s been taking some great pictures.
  9. I’ve recently started planting more house plants. I added more snake plants, bird of paradise, cactus, and an aloe plant. Outside: I replaced a large weed with an annual Lilly.
  10. I learned how to make side cars with the brandy that my friend Erik gave me for my birthday.
  11. I learned about how amazing Oaxacian tamales are. I had these at the Taste of Little Village Festival

I’m sure that I’ve been up to more, but that’s all that comes up to mind

I’m asking for your help. (About this Summer)

The Youtube Casey Neistat inspired me with his recent video on the beginning of Summer.

This made me think. How can I make this summer the best that I have ever had.

A quick list for me came up to:

  1. Go out swimming in Lake Michigan (I haven’t done that in the last 4 years that I’ve been here)
  2. Rent a Jet Ski
  3. Visit a state that I haven’t yet. (Michigan will probably be it)
  4. Fly to somewhere new (I’m tempted to come out to Austin)
  5. The x-effect with meditation (Maybe?)
  6. Grill out an absurd amount.
  7. ….

But here is the challenge that I’m putting out there for everyone reading. What are some things that I could do to make this summer the best ever?

Please leave the comments below.

Something I love about the builder pattern

It makes the construction of similar objects a lot easier.

For this example, let’s assume that a ComplexPerson object represents a human that has parents, and has attributes such as age, name, etc.

ComplexPerson.Builder jimJaneFamily = ComplexPerson.builder().getParent(jimReference,janeReference);

To create new children from the same template, you would just use the builder “jimJaneFamily” object, adjust the new attributes and call build. A new builder object isn’t necessary as that the modifiable fields are overwritten and the builder is no longer relevant after the build method is called. Reusing the builder object looks a lot cleaner compared to new initializations per new object.

That’s pretty cool.