Gowhere

I started some Go code. "Go where?", I wondered. For some mysterious reasons, I liked the term Gowhere. Let’s create a repository on GitHub to play with Go (Golang)—Gowhere.

Heading to Golang official site, following the instruction, I started to write code in no time. It is really fast and easy to get started. Let’s start with the infamous "Hello World!" application.

Installing Go is easy and straightforward

  1. Download the installation package from the official website, choose the one for your OS. I installed for both MacOS and Windows
  2. Run the package and follow the instruction—Next and Next and Done
  3. Open the command line, run this command go version

I use VS Code, highly recommended, as my code editor. One I created my first Go file and opened with VS Code, it suggests all the plugins I need to be productive with Go. Nice!

So far, I’ve known Go in a single file—write code in a file, no executable package. To run a Go file, I ran go run filename.go in the terminal—either inside the VS Code or Command Line or PowerShell or MacOs terminal.

Create hello.go and try it out

package main

import (
    "fmt"
)

func main() {
    fmt.Println("Hello World! Greeting from Go")
}

Neat and straightforward. There are 3 parts—package, import, and func.

Package – define the namespace (in C#) or a higher logical abstraction for other functions, methods. Which means that every Go file requires a package definition.

import – import functions from other packages.

func – Define a function. In the above example, main is the entry point function.

What if I changed the names—package name to main1 or function name to main_v1? – Failed. The compose main_main is strictly required.

The bracket ({) must be in the same line with the function name. This code will cause compile error

func main() 
{
    fmt.Println("Hello World! Greeting from Go")
}

All those errors are caught at the compile time—Go is a statical language. With the help from VS Code, I do not have to remember or worry about them. I will remember them when I write more Go code.

Go has a set of data types—just like any other languages. What are new to me are the Defer and Pointer. I knew pointer back in the university. Since then I have not used them. Thank to the C#.

Defer allows developers to specify callback functions to be executed in Last In First Out (LIFO) order once the main function completes its execution. I’ve not understood what it is used for—maybe to clean up resources. But I think it is an important concept in Go. I will find out more when I step further.

"How do I pass the returned value from the host method to deferred methods?", I wondered. I figured one possible solution using pointer.

Pointer holds the address of a variable. Which allows the consumers access the latest value of a variable—I know your address, I will go there and get it. Sometimes, It is a dangerous thing, better use with care.

Defer functions are also functions. Therefore it is fine to write defer in defer as the below example.


func deferCallWorkLikeCallBack() {
    // Is it possible to pass the returned value from calling method to the deferred function?
    var number int = 1
    // This will pass 1 to the deferred method. So not a reference
    defer deferInDefer(number)
    // This will pass the latest number, which is 13, to the deferred function
    // Pass the address (pointer) of the number variable
    defer deferWithPointer(&number)
    fmt.Println("Hi I am a deferred call. You can think of me as a callback in your word")
    number = 13
}

func deferInDefer(number int) {
    fmt.Println("Hi you passed the number:", number)
}

func deferWithPointer(number *int) {
    // This allows the function to access the latest value passed from the calling function
    fmt.Println("Hi you passed the pointer to number:", *number)
}

If I pass a pointer to a deferred function, I should be able to access the latest value of a variable.

package main

import (
    "fmt"
)

func main() {
    defer deferCallWorkLikeCallBack()
    fmt.Println("Hello World! Greeting from Go")
}

Will produce this output

Hello World! Greeting from Go
Hi I am a deferred call. You can think of me as a callback in your word
Hi you passed the pointer to number: 13
Hi you passed the number: 1

That’s a good start. I might go somewhere.

Apply Zettelkasten to improve English with Trello

Recently, I was introduced to Zettelkasten from X-Team blog. It is a system, a method to capture and retain knowledge.

Zettelkasten suggests an approach to solve a common problem – Unless you have a super memory, you forget what you have learnt weeks ago, even days. "I remember I read it somewhere, that I know it" – I told myself many times when, for example, I saw old words. Words that I read the other days in articles, in conversions,…

Nowadays, knowledge is almost free. You can search for almost anything using a search engine such as Google, Bing, … We do not have to remember too much as far as we know what and where to find what we need.

That reasons well with some area, especially information that we do not need to access frequently. I want to turn information into my knowledge as much as possible. That is the only way for me to grow.

Being a software developer, I use English in my job, mostly in writing. I write code in English; I write/read documents in English; I communicate with my clients, coworkers in English. I am glad to have opportunities to learn new words, new expressions. Below is my flow when I meet a new word

  1. Lookup their meanings, usually via Collins Dictionary – I highly recommend it
  2. Read through the definition and guess the meanings. And to understand what the other person (or the document) was trying to say

The flow took around 1-3 minutes. And I was done. I declared the victory. I thought I got it. Until! A few days later, or weeks, I saw it again. I could not access its meaning from the memory. I knew it. I just could not access it. The knowledge about that word was not mine.

So the best thing I could do was to repeat the flow, again. It sucks! Really sucks!

When I read about Zettelkasten, an idea was flashing in my mind. Hey! I could utilize this system to capture and retain knowledge. I could improve my English situation. So I have started Zettekkasten.

Zettelkasten-English-Board
Zettelkasten English Board

Tool – Trello

Next, I need a tool to capture knowledge. Trello came to my mind immediately. I have been using it for years. I knew it was a perfect tool for this purpose. I suggest you visit Trello for a complete list of features, of what It can support your creativity.

Why Trello? Because:

  1. Access everywhere as far as you have internet access. You can use the web version, the mobile apps version (Android and iOS)
  2. There is a free version which supports basic functionalities. That is all I need for knowledge capture
  3. Organize information in lists and cards. A card is like a sticky paper note, a perfect tool to brief information
  4. Easy to use
  5. Search fast
  6. It gives me the feeling that I am working with paper and sticky note, the paper sticky note. That feeling is important because it lowers the barrier. So simply it makes me feel good

Prepare the garden

Trello is a general purpose tool. You use it with your own creativity. To use it for Zettelkasten (yes I use that term more often to remind me of capturing and retaining knowledge), I have to prepare. Turn Trello’s list and card into Zettelkasten holder.

I decided to group words by months. I wanted to see what I have learned over the time; and at what moment (at what month is good enough) in time.

  1. A list is a month
  2. A card is a word. The card title has a short description of the word. This allows me to recite them faster by glancing at the board. All the detail, example, … is in the card’s description. And usually I put a link to the Collins Dictionary. I can read them in detail by following the link. Easy and fast

I name the board: Zettelkasten – English. This reminds me of the approach I am using and what the board is having. Next year, I might need a new board with the year. But now, I do not worry that much.

It is easy like that.

So my flow has changed

  1. Look up the meaning in the Collins Dictionary
  2. Create a card in the right list. If the list (the month) does not exist, create a new one. It is important to spend a little time to write your own understanding of the word

Note: Avoid copy and paste as much as possible. Writing will help remember better.

Eat the fruit

Setting up and leaving it there will not help. I need to tweak my routine, my habit to take advantages of the Zettelkasten.

At work, I often open that Trello board in a browser tab. It allows me to add new words faster. Some minutes of reviewing the board has a tremendous impact on my memory. It will enforce my long term memory.

I also install the Trello app on my phone. I have short idled periods while waiting for my kid, before taking them to school and pick up after classes. Instead of visiting facebook, twitter, news, … open the Trello first; glance at the board, and continue my normal routine if I wish to.

The app allows me to add new words anytime, anywhere. I simply capture them first, then work on the detail later.

I utilize my time better without impacting anything.

I have had the setup for over a month (there are 2 months on the board at the time of this writing). So far it works beautiful. I still need to practice and enforce my disciplines.

Why do I limit myself only to the English? So I have applied in other knowledge areas: technology, book. They require different setups but the principles remain.

Zettelkasten with Trello sound a good couple.

Teamwork by Giving Implementation Hints

Tom and Jerry work in an agile development team building a web application. The team has 4 developers. In the planning meeting, Tom is assigned to a product backlog item (PBI). The PBI is simple. Anyone in the team can implement it.

Tom implemented the PBI the day after. It worked. A pull request (PR) was created and asked Jerry to review it. It is a normal process of the team.

Jerry left a comment in the PR:

Hi Tom, we already implemented the same thing at X feature. There is a common method that you can reuse.

A very constructive, useful feedback. Except the consequences:

  1. Tom has to throw away his implementation and reuse the existing one
  2. Waste of time from both sides: implementer and reviewer

Does it sound similar to you? – A common problem: Developers re-invent the wheel.

Why

The fact is that it is hard for a developer to know everything in the system. For many, that is impossible. Developers take PBI from the sprint backlog and work on them. How could they know what are already implemented? What could they reuse?

Discussions can help if you know what to discuss. Asking questions on the team can help if you know what to ask.

Reflecting on your team, how many times do your developers ask questions regarding to the implementation, to what to reuse. It is easier said than done.

Developers tend to write their own implementation. Because they think it will be faster and safer for them. So they just write code. And one cannot ask that question for every single PBI.

What Could We Do to Improve?

I am not a big fan of theory saying that developers should be proactive, ask questions. Yes. They should and they might will if that is the business logic. Or that is something unclear in the specification. Implementation? Not really.

Well-planned in the planning meeting can help. However, people have not talked much about technical design (or implementation hints) in the planning meeting.

Asking questions in the daily stand-up? I have not seen many questions asked in that regard. Most of the messages in the daily stand-up are status report. Just they are expressed in a different way.

So what could we do?

Give implementation hints in comments of PBIs

Each developer has different knowledge about the system. When an PBI is reviewed, some might have an idea of:

  • What it is
  • How to implement
  • What could be reuse
  • Reference points such as old PBI, Pull Request, or a specific commit

So instead of keeping them in your head, write comments in the PBI. When a developer starts implementing the PBI, he/she has a good starting point. From there, he/she can start discussions, asking questions. Because they know what to ask and who to talk to.

In a team, the most skilled, familiar with the code should look around the team backlog. Try to give as many hints as possible. Anyone can do it as well.

The approach has a compound effect. The teamwork is at the next level. Developers care about other PBIs, about the team. It also encourages conversions, engagement. When a developer leaves a comment, the conversion has started.

Take Away

Give implementation hints, folks, give implementation hints. Your teammates do not know what you know. The developers working on those PBIs will thank you. And in turn, they will do you a favor. That is where the conversation, the engagement begin.