Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V3] Concepts List #1390

Closed
tehsphinx opened this issue Jan 17, 2020 · 28 comments
Closed

[V3] Concepts List #1390

tehsphinx opened this issue Jan 17, 2020 · 28 comments

Comments

@tehsphinx
Copy link
Member

Source to compare once this list gets edited: https://github.com/exercism/v3/blob/master/languages/go/reference/README.md

Go

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.

Specialties

Concepts that are special to Go or have key differences to a vast majority of other languages.

  • Channels
  • Code Formatting
  • Concurrency
  • Constants
  • context.Context
  • Defer
  • Empty Interface
  • Errors and Error Handling
  • Goroutines
  • Modules
  • Multiple Return Values
  • Named Returns
  • Nil
  • Packages
  • Panics
  • Pointers
  • Readers, Writers, Buffers, Pipes
  • Recover
  • Reflection
  • Select
  • Type Switch
  • Unsafe
  • WaitGroups
  • Zero Values

General concepts

Object-oriented Concepts

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?

  • Structs (Classes)
  • Method Sets
  • Encapsulation
  • State
  • Mutation
  • Composition
  • Polymorphism (?)
  • Interfaces

Functional Concepts

Go is not a functional language but has a lot of features that enable us to apply functional principles. Functional Go

  • Anonymous Functions
  • Function Composition
  • Higher Order Functions
  • Multiple Return Values
  • Named Returns
  • Nested Functions
  • Partial Application
  • Pipelines (?)
  • Pure Functions
  • Recursion
  • REPL (some community projects)
  • Type Inference

Advanced

Patterns

Concurrency

  • synchronization for sharing memory (mutex, atomics)
  • synchronization via communication (channels)
  • data protected by confinement (guard pattern ?)
  • for-select loop
  • fan-in, fan-out

Types

Types 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.

  • array (rarely used)
  • bool
  • channel
  • function
  • interface
  • interface{} (empty interface)
  • map
  • nil
  • Numeric Types (uint types, int types, float types, complex types, byte and rune)
  • pointer
  • slice
  • string
  • struct
  • time.Duration
  • time.Time

Tooling

  • go doc / documentation, eg export & package documentation. Machine/human. Inline "why"
  • golint
  • go vet
  • go test / writing tests
  • benchmarking / profiling
  • gofmt
  • golangci-lint

Resources used

@tehsphinx
Copy link
Member Author

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.

@sebito91
Copy link
Member

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?

@sebito91
Copy link
Member

Of course these would be purely OPTIONAL topics ^^

@tehsphinx
Copy link
Member Author

@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 😄 .

@tehsphinx
Copy link
Member Author

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...)

@hans-d
Copy link
Contributor

hans-d commented Jan 20, 2020

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"
  • zero values (more likely part of variables)
  • golint
  • go vet
  • tests
  • benchmarking / profiling
  • mindset / approach (line of sight, keep it simple, multiple returns, ...)

@tehsphinx
Copy link
Member Author

tehsphinx commented Jan 20, 2020

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)

@tehsphinx
Copy link
Member Author

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.

@tehsphinx
Copy link
Member Author

tehsphinx commented Jan 20, 2020

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.

@tehsphinx
Copy link
Member Author

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?

@tehsphinx
Copy link
Member Author

Added JSON Handling as that can be quite a stumbling block for people new to Go.

@tehsphinx
Copy link
Member Author

Just added a bunch of concepts:
Switch
Globals
Ignoring (return) values
Init function
Select
Goroutines

@andres-zartab
Copy link
Contributor

What about constants and type aliases?

@tehsphinx
Copy link
Member Author

tehsphinx commented Jan 21, 2020

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?

@andres-zartab
Copy link
Contributor

andres-zartab commented Jan 21, 2020

Yeah, probably best to leave them untouched for now.

@DavyJ0nes
Copy link
Contributor

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 😄?

@hans-d
Copy link
Contributor

hans-d commented Jan 22, 2020

Some other:

  • debugging
  • source code layout
  • compiler, flags, cross architecture

@andres-zartab
Copy link
Contributor

Some that came to mind:

  • Recover
  • math/rand vs crypt/rand
  • Trailing commas at the end of structs/maps allow to have fewer lines affected when PR's add new cases

@tehsphinx
Copy link
Member Author

@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?

@tehsphinx
Copy link
Member Author

@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.

@tehsphinx
Copy link
Member Author

Very good comments here! Keep them coming! 😁

@andres-zartab
Copy link
Contributor

@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.

Yeah, maybe we could introduce it as a DYK when working with maps and structs or something like that.

@andres-zartab
Copy link
Contributor

We could also add:

  • Buffers, Readers, Writers
  • CSV parsing

@tehsphinx
Copy link
Member Author

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...

@tehsphinx
Copy link
Member Author

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.

@BethanyG BethanyG changed the title [Go] Concepts List [V3] Concepts List Jan 28, 2021
@BethanyG BethanyG transferred this issue from exercism/v3 Jan 28, 2021
@Lewiscowles1986
Copy link
Contributor

Should be noted that pointers, and maps are dealt with in the current concepts stage, so can probably be ticked off the list.

Not sure if I'm telling a dog how to bark here, but if you * [] you can get tick-boxes, and progress can be communicated.

@Lewiscowles1986
Copy link
Contributor

👍 for

  • goroutines
  • waitgroups
  • select
  • channels

@junedev
Copy link
Member

junedev commented Oct 23, 2021

To give a better overview of what's already implemented etc there is a roadmap document now and a new issue for discussions: #1886

@junedev junedev closed this as completed Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants