Thursday, 21 September 2017

Google OnBoard - Google Cloud

“Almost all the successful microservice stories have started with a monolith that got too big and was broken up.”
- Martin Fowler1

On the 20th of September 2017, I enjoyed a full day at Eindhoven HighTech Campus listening to Google explain everything about their Google Cloud Platform (GCP)2. It's the 63rd or so time this workshop was given. (20.000 people 36 cities)

Of course, I needed to write some of the stuff down, so here's the stuff.

I liked the April fools joke shorts that were interspersed in the lecture.

The problem everyone seems to be facing is that everything needs to be done faster, and better and there needs to be more focus on building business value, instead of having to spent time administrating the hardware.

This can be seen in the fact that the most expensive item in your organisation are your engineers, and they need to be able to work as efficient as possible. Google noticed in the past that time spent doing things that ultimately were of little value can not be regained and is forever lost.

When it comes to the evolution of clouds, you see the following waves happen:

1st wave - colocation
your kit, someone else's building, yours to manage.
2nd wave - virtualized data centers
standard virtual kit, for rent, still yours to manage.
3rd wave - intelligent services automated everything
invest your energy in great apps

Funnily enough, I am noticing this same trend in my home hobbyprojects as well. It can be summarised as follows:

1st wave
I had my own computer, but to install it in a data centre, it needed a rack-mount. My hardware in somebody elses data center.
2nd wave
My computer now is a VPS that I rent.
3rd wave
I started moving small apps over to the Google App Engine.

For a lot of software companies (mine included) we are still only on the second wave. The products of lots of software companies do not require some of the advantages of the cloud and it therefore makes no sense to make the effort.

You can just assemble the google "hexagons" that your application is going to need. It takes a little work to find out what Google has and how it can be best applied to your situation. Because, everybody's situation is different.

Why choose google? If you do use google, you use the netwerk Google created (which is fast), to access other Google users (which use the same network), which are therefore only a hub away.

Googles network is divided in regions and zones. A region might for example be Europe, and a zone might be a data center in a specific region, for example West-1a.

The Google hexagons can be roughly categorized into four main groups, as displayed in the following most important sheet:

StackDriver

StackDriver is a company which was bought up by Google and it specializes in "supporting glue" for different components in an application:
  • Logging
  • Monitoring
  • Debug
  • Error Reporting
  • Trace

Philips Hue

As an example of what it can do, Philips was there to explain how they have been using the cloud along with their new Smart-bulbs in their home-automation project called Hue.

It is a long day to listen, luckily with the free trial version3 of the Google Cloud Platform, it was possible to follow the two gentlemen along in their path through the different components of the platform.

There were some lighter notes as well. For example the spot-the-security-guard in pictures of the Google Data Center. The Machine Learning demos were quite fun too.

I can highly recommend the workshop, for anyone who wishes to have an idea about what Google can do to help your application become great. The sheets alone give a good impression.

References

[1] Martin Fowler - MonolithFirst
https://martinfowler.com/bliki/MonolithFirst.html
[2] Cloud OnBoard - Learn how to Build What's Next with Google
https://cloudplatformonline.com/2017-onboard-benelux.html
[3] Google - Free Trial
https://cloud.google.com/free/
Google Developer Group Netherlands
gdgnetherlands.org
Google QwikLabs
google.qwiklabs.com
Measure your latency to GCP regions
http://www.gcping.com/
Coursera - Google Cloud Platform
https://www.coursera.org/googlecloud
Google Certified
https://cloud.google.com/certification/

Wednesday, 20 September 2017

Statics in Java - Answer

The output of the program in Statics in Java:
/opt/tools/java/jdk1.8.0_60/bin/java com.mrbear.Test1
Mount Monadnock

So why don't we get a NullPointerException, which most people would expect?

As indicated in the JLS 15.12.4.11, static methods are directly called on the Class, not on the Object, so the presence or absence of the object is entirely irrelevant.

This is one of the most compelling reasons for always using the Class to call static methods on instead of the Object. It prevents ambiguity for us poor software developers.

P.S. When you think about it, "null" in Java is actually a bit weird, as it can be forcibly cast to any java Object.

References

[1] The Java Language Specification, Java SE 8 Edition
https://docs.oracle.com/javase/specs/jls/se8/jls8.pdf

Thursday, 14 September 2017

Statics in Java

This one comes straight out of the Java Language Specification1, paragraph 15.12.4.1:
class Test1 { 
    static void mountain() 
    { 
        System.out.println("Monadnock"); 
    } 

    static Test1 favorite()
    { 
        System.out.print("Mount "); 
        return null
    } 

    public static void main(String[] args) 
    { 
        favorite().mountain(); 
    } 
}
What is the output of this program?

References

[1] The Java Language Specification, Java SE 8 Edition
https://docs.oracle.com/javase/specs/

Wednesday, 6 September 2017

Method Overloading in Java - Answer

The output of the program in Method Overloading in Java:
/opt/tools/java/jdk1.8.0_60/bin/java com.mrbear.App
Hello World!
Brian Goetz
Object
Object
So, from the tutorials1:
Note: Overloaded methods should be used sparingly, as they can make code much less readable.
Quoting2 from the JLS3:
When a method is invoked (§15.12), the name of the class, the name of the method, the number of actual arguments and the compile-time types of the arguments are used, at compile time, to determine the signature of the method that will be invoked (§15.12.2).

References

[1] Oracle The Java™ Tutorials - Defining Methods
https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
[2] StackOverflow - Overloaded method selection based on the parameters real type
https://stackoverflow.com/questions/1572322/overloaded-method-selection-based-on-the-parameters-real-type
[3] The Java Language Specification, Java SE 8 Edition
https://docs.oracle.com/javase/specs/jls/se8/jls8.pdf