loading...

Discussion on: Critique My Code: Sudoku Solver in Go

Collapse
okolbay profile image
andrew

I really wanted to do a proper code review with comments or even a PR for you to see a diff. Maybe I will still find some time for it.
Try to avoid counters in foreach. You’re not quite right that this is java way. This is the way you were taught programming. And its not quite right. “One or more - use for” - use it to print 10 lines to console. Don’t use it to iterate over collections. Use foreach (golang has it and you are using it too)

Nested loop is a code smell - at least extract inner loop to separate method.

In general, use power of method name semantics - each time you comment a block of code explaining its purpose - extract a method!)

Naming is hard. Instead of giving methods fancy names, that dont reflect reality, if you cant find a good name at once - be honest. Give your method an awkward name. It will be both an indication of a questionable design and TODO to refactor it, so that these few lines truly deserve a nice short name.

Mid to long term advice - read Clean Code )

Collapse
mas profile image
Sam P Author

Thanks for all this, I really do appreciate the feedback, and I'll make sure to take this into account!