Recently I was asked to review PACKT Publishing‘s Video courses on “Building Your First Application with Go” from Rostyslav Dzinko. I’ll accept I thought it would be just beginner’s stuff looking at the title, but designer of course has managed to bring in an interesting flow and some good practice points along the flow.
~Review~
The course structure is very broad, let not the course title make you take a narrow view. It covers from the mere basics of downloading and installing Golang compiler. Then slowly moves on to teach how to build a full working web application for image effects with some good dev practices.
What would you gain from it?
It’s formed of 8 fine sections which gradually make you familiar with different constructs of Golang internals.
The first section covers getting your workspace ready to try out Golang programming and strcture of a Golang program. It introduces to tools provided by Golang for seeking help, checking respective environment variables, lint formatting the code, running/building/installing Golang program. Shows example of a program taking input, processing the value and sending it to standard output. Then it ends with single line and multi-line style of commenting and quickly ends with introduction to Godoc way of Golang Code Documentation.
The second section starts with basic definitions of variable and constants, scope availability and then discusses the type inference capability. It details out all the important data types and example usages of each. In the end Narrator points to “strings” packages for learners to go and explore, which is good in a way not to serve everything on a platter. While giving intro to maps the Narrator also gives a taste of easy serialization/deserialization of data in Golang using example of “encoding/json” module.
The third section focuses on Control Structures. Covering if-else and switch-case for conditional logic, few variations of for for loop. It also talks of handling error and comma-ok notation returned.
The fourth section is about structuring the code with package and functions. Examples are given of functions, anonymous functions, packages, init functionality in packages and usability of deferred execution.
The fifth section familiarizes learners with the example of practicing Object Oriented Programming using Golang constructs. Narrator starts with insight on use of Structures in Golang with some examples and how can behaviors be added to Structures. A very good work has been done at explaining interfaces with gradual examples. It’s one of the philosophically misunderstood thus hated feature of Golang ad the Narrator has done a good job in averting that for beginners.
The sixth section is dedicated to one of the forte of Golang, concurrent system programming. Narrator shows some neat easy examples around usage of Goroutines and then brings in a better usable approach with “runtime” and “sync” package features. Then he explains well on role of Channels with good usecase examples. He showcases use of buffered channels, fan-in pattern, fan-out pattern also in a very simple but clear way.
The seventh section is their to make learners familiar with Golangs built-in package power for web application development. There are examples here for running a web server, handling routing, using HTTP GET request parameters. Narrator also gives a quick demo on using “Gorilla Web Framewoek“‘s routing and query param capabilities giving a sample Golang being ready for advanced web-app development. HTML Templating library is also covered in a decent manner. It ends with intro to panic and recover feature of Golang, which are not specific to web programming but specific to any good Golang project.
The eigth and final section is all about using what all has been covered so far and turning it into a real world web application capable of uplaoding an image; then performing color inversion and rotation on it. Narrator uses Golang’s “image” package for image transformations and the upload files are just kept in memory map of image filenames to file-data blobs. Then in the end he refactors the grown messy code into independent packages with real scenario implementation on interfaces. He also introduces a smal test case showing how code can be tested in Golang while introducing httptest library.
Occassional mentions of few philosophical decision is also there.
What could have been better?
(There is a fair possibility that I missed Narrator doing it but if I didn’t miss it.)
- In third section Narrator doesn’t cover for-range usage, though uses it in fourth section and further later. Range brings a very widely implemented practically used power to for control structures.
- Narrator forgot new behaviors can be added to any local type, not just structures. An example on this would have eased up how behaviors can be added to a local type declared on string (or other).
- In Section 8, when Narrator starts to use “image” package for Image Upload and other actions… in certain functions (like HandleUpload) identifier of “image” name has been used. When “image” package is already imported, no identifier should have been named so. It doesn’t error out because “image” is not used in that function scope as a package, but it’s still not a good practice and can result into error as function get changed over time in real scenarios.
- Some of the important philosophies that learners of this course shall look at after completing are, to have better understanding of certain things in Golang
- minimalistic design of Golang could have been mentioned while introducing “for”
- Communicating sequential processes, belongs in section six
- Would have preferred if he did demo of “hello world” on play.golang.org and then moved to system installation with editor driven coding. It gives learners a very easy taste of it first and also show how easy is it to tryout Golang. Also play.golang.org can be projected as a starter place to browse through examples for more understanding of good and bad code.
- One thing could have been improved on showmanship of course, that is showing build result of code in Editor windows’s pane. Almost all good editors today have addons for Golang providing this and lot more. Since Narrator was using “Sublime Text“, he could have used plugin “GoSublime“.
Overall
It’s a lot more hands-on than theory which is great. Though out of 8 sections, first 7 sections are mainly focussed towards beginners in Golang who want have a complete understanding of it and are preapred well for it (they are like covering Effective Go in a video). Still the last 8th section can be utilized by even intermediate level Golang developers who understand the constructs of it but face hard time bringing in good development practices they have been using in other programming languages. I felt some bits missing here and there which I’ve already mentined in “What could have been better?” para above.
There two good things about this course that I want to highlight: * Usage of examples and then building over them for coming part of course showcases how to finely grow a spiked Golang code. * Cleverly covering few good developer practices by hugely improving upon the mess of code written for “First Application (WIMP)”. The coding practice worried me in intial part of the section but when Narrator refactored it, the intention was clear.
Overall, it’s a good course for anyone trying to get started in learning Golang or are in their early stages.