DevNexus 2019 – Go Java Go! – Andres Almiray

See the table of contents for my other blog posts from the conference

@aalmiray

Java is 23 years old. Go is 9 years old

To run

  • go run prog.go – compile to temp directory and run
  • go build pro.go – explicitly compile
  • ./prog

Syntax

  • package name [no semicolons]
  • import “target”
  • fun main() {}
  • fmt.Println(“Hello World”)
  • fmt.Println(“one”, “two”)
  • if a == b [no parens]
  • func name(type int) int { return 0 }
  • fun name() (int, string) { return 0, “OK” } – can return multiple values
  • type Name struct { name int } – when need to create a type. DOn’t need a lot of them
  • s := MyStruct{value}
  • s := MyStruct{name: value}
  • fun (s MyStruct) function() {} – attaches function to a struct. Can then call on a MyStruct variable

Scope

  • uppercase symbol means public
  • lowercase symbol means private (to package)

Data structures

  • var strs = []string{“a”, “b”} or strings := []string {“a”, b”}
  • mapOfValues := make(map([string]int)) or mapOfValues := map[string]int {“a” : 1}
  • mapOfValues[“foo”] = 1
  • var array [4]int – ust be exactly 4 ints

Concepts

  • Can create nested functions
  • No classes or methods
  • Constructors are automatic
  • Get compilation error for unused code
  • Only one keyword for loops. Use “for” and omit sections to make while loop
  • No exceptions
  • float64 data type

Features unique to Go

  • The interface{} type is roughly equivalent to java.lang.Object. “Just” need to ensure provide implementation of the method.
  • can use return type “error” and call errors.New to indicate an error. Can return nil if no error. Assign error to variable named _ to indicate to compiler that intentionally ignoring. [I don’t get how this is better; it seems like there would be error handling everywhere]
  • Type cloning: type foo int – treat foo as int. However, cannot pass foo when int expected
  • Type alias: type foo = int – treat foo as int, but can pass foo when int expected
  • gRPC – use instead of REST. Remote procedure call framework. gRPC works with many languages including Java and Go.
  • web assembly – can run go code on the browser. Can compile Go code into web assembly

Performance

  • Runs faster than Java with Java defaults. Not comparing to Graal for native code
  • When build code, runs faster than simply running it because interpreted

Links

  • gobyexample.com
  • play.golang.org -run Go online
  • github.com/cdarwin/go-koans
  • golang.org/cmd/gofmt – automatically formats code according to go standards. Developers do not get to choose or argue.

My take

I learned a lot and it was easy to follow. I can feel my brain getting full.

Dev Nexus 2019 – Java Puzzlers NG S04 – JFrog

See the table of contents for my other blog posts from the conference

Baruch Sadogursky @jbaruch and Viktor Gamov @gamussa

#javapuzzlersng #devnexus

Background

  • Java Puzzlers – 2001 at Oracle Open World. Did many years in a row
  • For later versions of Java
  • Slides with all answers at jfrog.com/shownotes

Survey

  • Only a handful of people on Java 11.
  • Most people on Java 8
  • Unsurprisingly, hardly anyone on non-LTS versions

Note: they requested not posting the answers (even though they are online).

Puzzles

  • If you have an instance variable does This.this.this or this.this compile?

Fun facts that are not the answers

  • Can use non-English characters

How I did/observations

I got 33% (3/9) right. Well, slightly better than guessing randomly :).

  1. I was one of two people to get the first one right! It helps knowing it is a puzzler. I would have guessed compile otherwise!
  2. A lot of people including me got this right. It turns out a new an obscure bit of trivia that showed up in the question but wasn’t relevant to answer it. Fun!
  3. First one I got wrong. That was subtle!
  4. I got this wrong again. I knew the first trick, but not the second. Damn, the compiler is smart!
  5. Three wrong in a row. Again, I saw the first trick, but not the second.
  6. Fourth wrong in a row. Definitely a WTF moment for the answer! (These are great)
  7. Fifth wrong. “Good distribution of answers” – does that mean people voted randomly?
  8. Finally got one right after a while
  9. Ooh a Java 10 one! None of the tricks I could think of in this space are in the question. (Got it wrong of course)

My take

This was fun. They are great showman, have good rapport and had really obscure interesting puzzlers. I also like the showed docs for some of the obscure stuff.

DevNexus 2019 – Containing the Cloud – Wes Widner

See the table of contents for my other blog posts from the conference

@kai5263499

Containers

  • Represent complexity
  • lots of components
  • notes help manage complexity – write down what doing
  • were not designed to be secure. Were designed for developers to have a feel of a greenfield system
  • just a set of processses
  • developers and ops have different goals. Need different images for debugging vs prod

Tips

  • Log and audit what is in the images. Logging smokes out bad practices. Can’t prevent password, but can catch it at build time
  • Prod image should come from CI/CD pipeline
  • Add forensics info to labels. Ex: git hash. Pretend the cloud is down. Can you explain what is in your image
  • Scan image regularly. The base image will become vunlerable over time. Scan hashes and layers of image
  • Build own scratch image or ami so know what is in it. This is hard, but then you know what is in it
  • Monitor what running to ensure what you intend
  • Config as code
  • Use read only mode in container where possible. Hard to break the container
  • Can tag so only data from specific pods can send certain data. Emerging tech. No standard yet
  • Can taint workers and only certain pods can run

Antipatterns

  • Allowing a broad set of system calls. Makes hard to find atypical patterns. Also broadens attack surface
  • Hypervisor shims – limit what can do
  • Chaos engineering – keeps you honest. A pod running for months and behaves differently on next start is hard to track down.

Cloud maturity

  • Access contol which can push
  • execution logs
  • images from a build system
  • version controk docker configs
  • tagged packets from pods and continuous image scanning

Links: https://www.selikoff.net/2019/03/07/devnexus-2019-containing-the-cloud-wes-widner/

My take

Lots of information. I learned a lot. I also realize how much I’ve forgotten about Kubernettes since i last poked it.