Source to compare once this list gets edited: https://github.com/exercism/v3/blob/master/languages/go/reference/README.md
This is a list of concepts of Go. They are categorized into OOP, Functional and General. The Specialties category tries to mention concepts that are somewhat special to Go. A concept can belong to multiple categories.
Concepts that are special to Go or have key differences to a vast majority of other languages.
Although Go has types and methods and allows an object-oriented style of programming, there is no type hierarchy. The concept of "interface" in Go provides a different approach that we believe is easy to use and in some ways more general. There are also ways to embed types in other types to provide something analogous-but not identical-to subclassing. Moreover, methods in Go are more general than in C++ or Java: they can be defined for any sort of data, even built-in types such as plain, "unboxed" integers. They are not restricted to structs (classes). Is Go an object-oriented language?
Go is not a functional language but has a lot of features that enable us to apply functional principles. Functional Go
go generate)confinement (guard pattern ?) fan-in, fan-outTypes are not really concepts but it might be helpful to have as list of types Go has as some might need an extra introduction. Some are already added as a concept above, e.g. channels, interfaces, etc. as there are special concepts around some of Go's types.
uint types, int types, float types, complex types, byte and rune)Above is a list of Concepts I have started in the early discussions around v3. This is by no means a finished list!
I would like to use this Issue as a discussion. Everything on this list is to be questioned!
I suggest we edit the list above as we go and then create a PR to update the changes to the repository.
My approach for this list was looking through the 3 links mentioned at the bottom and see what features/concepts Go has. Another approach would be to look at an exercise and break down which concepts are needed to solve it. Yet another approach would be to look at other tracks (e.g. C#, JavaScript) and see what concepts they use and whether that applies to Go. For example we do not have the concept of Strings in here yet where we could teach students about working with strings (e.g. concatenation, manipulation, iteration, etc.). Maybe that even needs multiple concept exercises.
This is an awesome start @tehsphinx, thanks for pulling this together! I'd like to propose extending this to an Advanced section that may not just be exclusive to go, but would include topics that an advanced go developer might use. To start, I would add the following:
ADVANCED
And also, do we think that adding concrete examples of golang projects would be good? A section called Examples or whathaveyou?
Of course these would be purely OPTIONAL topics ^^
@sebito91 Thanks! I added the Advanced section in the description with the concepts you mentioned.
Also added 2 more that came to mind: Assembly in Go and conditional compilation (plattform specific / build tags)
About optional: We will definitely not start with those 馃槃 .
I'm also wondering if and how we can maybe bring in Design Patterns. Not necessarily the classical ones (which might also be interesting and worthwhile) but more Go specific patterns that aren't needed or possible in other languages. Since Go is a simple language, some things are harder to do if you don't know about certain patterns.
What do you all think about this?
(of course we will need to focus on the core concepts first...)
Some thoughts, not sure if they are separate topics or should be part of others:
documentation (go doc), eg export & package documentation. Machine/human. Inline "why"
golint
go vet
tests
benchmarking / profiling
I'm generally wondering if we should go into the tooling of Go as well.
I'd say we can open a section on this for now. Anyone interested in adding that section? (if you can't edit the description above, just create the section in a comment and I'll ad it)
zero values (more likely part of variables)
Yes, could be part of a concept exercise teaching e.g. variables.
In my head I'm currently making a distinction between this document listing all the concepts and the list of concept exercises we need to derive from this after. There might be some concepts that need multiple concept exercises and other concept exercises might handle multiple concepts at once.
mindset / approach (line of sight, keep it simple, multiple returns, ...)
I'm not yet sure where to put this. Multiple Returns is in there already... the other things are important but hard to place.
Note: I added time.Time and time.Duration above as I think those are quite fundamental types to get to know. Any other types we should introduce?
Added JSON Handling as that can be quite a stumbling block for people new to Go.
Just added a bunch of concepts:
Switch
Globals
Ignoring (return) values
Init function
Select
Goroutines
What about constants and type aliases?
Added Constants. Not sure about type aliases because of this:
Type aliases are not meant for everyday use. They were introduced to support gradual code repair while moving a type between packages during large-scale refactoring. https://yourbasic.org/golang/type-alias/
Not sure we should teach them specifically. What do you think?
Yeah, probably best to leave them untouched for now.
This looks great. I'm wondering if it's worth adding a specific exercise around context.Context as it gets used a lot in web work and can lead to some interesting failures 馃槃?
Some other:
Some that came to mind:
@hans-d
compiler, flags, cross architecture
I see that in conditional compilation.
source code layout
You mean: how to structure code? package, folders, files, etc?
@andres-zartab
Trailing commas at the end of structs/maps allow to have fewer lines affected when PR's add new cases
An interesting detail we could have in a After.md as a "Did you know?". Not sure we should add it as a concept though.
Very good comments here! Keep them coming! 馃榿
@andres-zartab
Trailing commas at the end of structs/maps allow to have fewer lines affected when PR's add new cases
An interesting detail we could have in a
After.mdas a "Did you know?". Not sure we should add it as a concept though.
Yeah, maybe we could introduce it as a DYK when working with maps and structs or something like that.
We could also add:
CSV Parsing
I added it, although I think that is more a good use case for an exercise rather than a concept. It definitely is borderline...
Started with a Patterns section where we can gather different patterns to teach. I started with some concurrency patterns but this is by no means exhaustive.
Most helpful comment
Very good comments here! Keep them coming! 馃榿