DEV Community

Cover image for #001 Ultimate GO Notes Part 1
Omar
Omar

Posted on • Edited on

#001 Ultimate GO Notes Part 1

#go

Introduction

Those are my notes on ArdanLabs ultimate Bundle course.
You may find them help full because Bill know what his doing. And remember those are notes. Bill talk more about details and examples and more information that I know but you may not know. Also I write them based on my understanding including the drawings and diagrams.


Ultimate GO

Prepare your mind

  • GO model is the hardware

  • Hardware is the platform

  • Every decision have a cost , that's engineering else you are hacking.

  • Minds change slowly , Tech move fastly.

  • every programming language have a cost but cost in one language can cost more in GO and reverse.

  • image-20200819161836229

we are today in industry in front of legacy code problem ,

  • image-20200819162502434

  • products failed when they don't get into production , but If a project does , but we can't maintain it anymore that's legacy code.

  • image-20200819162708354

  • We don't put in mind software architect and design when we code or That someone else will maintain the code after us, that's make it hard to edit. We should put those in mind.

  • image-20200819162931465

  • image-20200819163154455

  • GO is really focused on the idea of reduce that number of lines of code/

  • image-20200819163348500

  • Debuggers don't remove bugs , it run them in slow motion

Productivity vs Performance

  • Performance is important , BUT in industry we forget that productivity is more important , The cool thing about GO is that we can get both.

  • The question should not be that is c faster ? this is not the important question. The important question is that How I can write a program that is fast enough in GO.

  • image-20200819164124930

  • image-20200819164225301

  • image-20200819164306079

  • GO is design to take the full advantage for the hardware we have today.

  • image-20200819164347230

we can replace c with GO in this quote because GO is also based on hardware model.

  • GO strike that balance between productivity and performance.

Correctness vs Performance

  • in go we never guess , we have the enough tooling so we don't need to guess , if we guess our code is wrong.
  • first we care about the correctness then in refactoring we focus on performance.
  • image-20200819165122393
  • image-20200819165141437
  • if I ask to write a blog post , in one hour I will give you an raw draft. What raw draft is first draft for blog post , Why I try to say this is not perfect so put in that in mind when you read it.
  • image-20200819165421669
  • let's say we are sitting in a room and the AC is working . After some time you will forget about AC and all what you care that you feel comfortable. But let's assume that this AC shutdown all what you care about now is who gonna fix it. So this is my Job I code every day in and out without anyone to know who I am , if someone know who I am , I failed because they will ask about my name to came and fix it. The only persons who should know my name is just my team.

Code Reviews

  • Code do 3 things all day , READ/WRITING and Allocating memory when need it , and to be more specific we are writing/reading integers all day because our processors are INT based (In case of AI/ML it's float b/c it's processing on GPU)

  • image-20200820004840333

  • at macro level Integrity (Arabic : Nazaha) , Bill call GO data oriented language not a Object Oriented Programming.

  • every data transformation should be precise or we will have integrity problems.

  • More code leaves more space to bugs to appear.

  • if you work with Bill you will spend 30% of your time writing Code and 70% refactoring it.

  • people don't like tedious (boring) things , our tests and error handling should be tedious because that's Engineering we should think when this code gonna break

  • image-20200820010309363

  • image-20200820010356625

  • We don't need to hide cost . example : the code behave on his own way (Bill give a c++ example in the video 14:20) . Like we should know what is the cost of our lines , and if the compiler is hiding things from us.

  • I should ask myself if I am the average developer in the team. If I am above the average , I should think is that code can be maintained by average team members or not.

  • image-20200820011401511

  • simplicity came in the last (refactoring) , the simplicity will fight with readability because if readability is about not hiding Cost , Simplicity is about hiding complexity . We need to make work first then make readable then we need to make it simple. You don't have time NOT to do simplicity it should be a constant flow all day long.

If Performance matters

  • external latency Cost : performance death , because we are waiting to system calls , we are talking here about milliseconds of latency here. If you are using a micro services you already encourage milliseconds of latency on response time. And this is a HUGE cost.
  • Internal Latency Cost Types:
    1. Garbage Collector
    2. Multi threading and synchronization and orchestration.
    3. How we access data on our machine.
    4. Algorithm efficiency.

Top comments (0)