ofEvents chapter
Hi, I'm almost finished with a new chapter about ofEvents. The PR for it is https://github.com/openframeworks/ofBook/pull/253 It needs some proof reading, anyone willing to do so is very welcome.
There are some minor things that I'll finish during this week.
Although, I have a doubt about either being correct or being clear. In most of the code examples I am not complying with the rule of 3, in order to make the examples less bulky. I added a section about this rule. I'm not sure if I should make all the examples to comply with the rule of 3 or to keep it simple. Any thoughts about this? @arturoc @bakercp
ping @tpltnt @mikewesthad @ofTheo @ofZach
Cheers1
@roymacdonald I haven't used oF in quite some time, but I'd be happy to take a look and give some feedback later in the week. The others will likely have better feedback on things like how much of the common use cases & API you cover. Regardless, great to have another chapter in the book!
Hey @mikewesthad it would be great. I think that proof reading is important, as there might be issues with my English (as it is not my first language). There might be some strange wordings and stuff of that kind. Let me know once you've gone through it.
Best!
Busy week - will be taking a look today and sending you a PR
Hey @roymacdonald, this chapter was super helpful and I learned a ton while reading it. Thanks for writing it! I've used observer-based event systems in other languages, but had no idea there was one in OF. It was also nice to get some insight into the upcoming changes to the v0.10 API. I'm sending a PR (roymacdonald/ofBook#1) your way with a bunch of detailed suggestions and feedback in-line, but there were a couple general things that I wanted to highlight:
- Nice job breaking an abstract topic into small doses that build up progressively.
- It's a text-heavy chapter, so adding pictures/gifs of the example code running would go a long way to 1) break up the text and 2) to make it immediately clear at a glance what the example is meant to do.
- I think it would improve the readability if you broke up the classes in your code snippets into separate files. It would better match real-world use cases. Along with that, I would suggest including all the source code along with your chapter in
chapters/events/code/. That way you can link from your chapter directly to the full source making it easier for readers to download the source files and get everything running. - In your ofApp examples, you've got a lot of empty methods (
keyPressed,windowResized, etc.) that you can just omit from the cpp and header. It would help streamline the sample code and make the core points you are making jump out. - I like the latter examples in the chapter where there is a concrete, specific use case (e.g. making things similar to a button). Your earlier examples would benefit from that strategy too. E.g. instead of the first example using abstract names like
AandBfor classes, you could call themFrameEventSubjectandFrameEventListener. I find that abstract names/examples tend to be especially hard when teaching beginners.
Anyway - nice job and a great addition to the book.
@mikewesthad regarding this comment of yours
In your ofApp examples, you've got a lot of empty methods (keyPressed, windowResized, etc.) that you can just omit from the cpp and header. It would help streamline the sample code and make the core points you are making jump out.
I just left these because the empty example has these and so it is not a confusing thing for newcommers, as why sometimes there are this funtions and sometimes not. I completely agree that it is better to remove this empty functions. If there's no problem adding examples that don't have these I'll be happy to ditch these.
@roymacdonald hmm, I think you could include them in the source files and exclude them from the chapter text. It might be good for us to add a note somewhere in the book about being able to omit unused methods from ofApp. "How openFrameworks works" seems like a good place.