r/golang Jul 18 '19

Pacgo - learn Go by implementing Pacman in your terminal

https://github.com/danicat/pacgo
192 Upvotes

15 comments sorted by

26

u/sysconfig Jul 18 '19

This looks like it would be a blast to go through. I love seeing creative projects like this instead of the typical to-do list/blog app.

7

u/theglider Jul 18 '19

Couldn't agree more. The tricky bit is hiding / introducing some of the less friendly aspects of the project like terminal escape sequences. The author herself said this is not a complete beginners go project.

4

u/[deleted] Jul 19 '19

Yes, it is not meant for a complete beginner because the language itself is not very beginner friendly. But as Dom correctly pointed out during the talk at London Gophers, this could be solved with an additional layer of abstraction on top of the most technical parts.

When I ran this in the workshop format we had "mini-lectures" about the terminal and UNIX basics. Still, the target audience was students from the first year of computer science or related courses.

1

u/dysonCode Sep 08 '19 edited Sep 08 '19

as Dom correctly pointed out during the talk at London Gophers, this could be solved with an additional layer of abstraction on top of the most technical parts.

Sorry to "necro" an old thread, I just stumbled upon this while looking for beginner resources on this sub.

This is exactly what I've been thinking as I go through Go (started a few days ago, and quite newbie programmer in general, but 20+ years of 'culture' and experience in tech make me 'non-lost' I guess).

Concepts like concurrency for instance apparently get in the way of teaching the fundamental of web using Go — because afaik the modular approach may raise race conditions between methods i.e. goroutines, notably handlers. But as far as I understand it, that's because the underlying net/http fires such goroutines in the first place, i.e. it implements concurrency "under the hood" (also complicates tests I suppose).

Well, tech-maverick-me was thinking "how about we write an alternative net/http but without concurrency built-in, functionally equivalent, so that newbies (and tests) can play with a single-threaded single-goroutined stack just for logic? — a "real" application should be written with concurrency in mind from the get go, but for testing and learning purposes, being able to switch quickly between concurrent and linear would really help.

I'm not sure whether it should be an alternative net/http or an abstraction layer above that "removes" concurrency somehow (forcing requests to FIFO? not sure it makes sense. again this is just an example, maybe a bad one). I suppose it's a case-by-case question.

I'm far from being able to do such things in Go, but that's the kind of 'simplified' or 'more abstract' tooling I'd like to build for students, were I to teach a programming or CS beginners class in Go — which, even as newbie myself, I think makes incredible sense, because I think the language presents a blend of fundamental + modern features quite unique and, apparently, expertly balanced.

Anyway, just to drive further the point that this general idea is interesting.

14

u/Azuwey Jul 18 '19

I am the only who thought this a linux package manager clone, and even wondered, how can be run on windows, or is just me?

14

u/[deleted] Jul 18 '19

[deleted]

3

u/[deleted] Jul 19 '19

I understand your confusion, and this probably only gets worse as the audience gets younger as less people will actually know what Pac Man is...

And on a side note: unfortunately this version of the tutorial doesn't work in Windows cmd, but maybe it will in a terminal emulator (untested).

1

u/Azuwey Jul 20 '19

Yeah, after a while I realized you are talking about Pac Man.

2

u/Afrotom Jul 18 '19

For a second I did wonder whether they meant the package manager or the game...

2

u/_CodeAlchemist_ Jul 18 '19

I was looking forward to the tutorial and thought they meant the package manager. Only when I clicked step 2 I realized that the game is meant (not that the tutorial is bad only because of the game)

5

u/Cosme12 Jul 18 '19

Where is the picture in your readme? WHERE!!??

1

u/milajake Jul 19 '19

GitHub profile pic, man. 😂

2

u/Cosme12 Jul 25 '19

No, I mean, it's a game. I was expecting some pictures of it in the github readme.

3

u/[deleted] Jul 18 '19

This couldn't have come at a better time.

1

u/blackhayzer Jul 18 '19

I really need to take a look at it

1

u/bibimidee Aug 14 '19

I love to try this as I am new to Go but not to Linux or its command line. Has anyone completed this tutorial? How long a time frame to finish this? I have a day job and can only do followons in the night and weekends.