openframeworks / ofBook

openFrameworks community book
706 stars 201 forks source link

C++ Basics Draft Feedback #31

Closed mikewesthad closed 9 years ago

mikewesthad commented 10 years ago

@jtnimoy I just got a chance to give your draft a close read. It's definitely great so far - easy to read and entertaining (Back to the Future reference is my favorite).

Your figures that explore the code visually (e.g. figs 11, 18, 21, etc.) will be a huge boon for those readers who are coding for the first time. Figs 28 + 29 are simple examples that are particularly effective. They help elucidate what is going memory-wise with just a few extra marks+words, and that's great for helping beginners see "beyond" the code to what is happening underneath.

I like ideone though I did run into a bug (that I couldn't replicate). Changes to the code wouldn't get compiled into the version that was being run. Tried saving, running multiple times, making multiple edits. I ended up chalking it up to having the page open to long and just refreshed it to get it working again.

I think it would be cool if your chapter had some companion site (or oF app) that would animate the ASCII output your code generates in ideone. Having to scroll is completely fine, so this is wish list type stuff, but being able to copy+paste the output into a textbox and then watching it move would be pretty cool. (Esp for your prime "random" generator.) An alternative might be to just include a few animated gifs.

I think a couple sections could use a conceptual introduction before jumping into code. The functions section comes to mind. It wouldn't require more than a sentence or two talking about what a function is, even if it is just from an english dictionary perspective. It would help orient readers for what is coming next. Same idea goes for the Variables (part 1) section and for the looping section.

Your email to the ofBook list mentioned cutting signed/unsigned and leaving out bitwise operators. That seems fine to me, and I take the silence on the email front as confirmation from the rest of the group? There could be a section at the end of the chapter where you just show some syntax, drop names/concepts and say where to go to find more info. That would arm readers with enough knowledge to feel comfortable diving into those things should they come across them in someone's code.

I feel mixed about the twitter thing since it feels a bit forced and transparent in that it is just about promoting ofBook. It might feel more appropriate in a place like at the end of your ball animation where you ask the reader to tackle some extensions. Or if you were to suggest they design their own random functions and then tweet a link to their ideone code (or a screenshot/gif of their stdout). Etc.

You jump into discussion about compiling and precompiling pretty quickly, which makes sense, but it could benefit from a simply flow chart thrown in there. Something that shows what happens to your code, so that newbies who aren't familiar with compiling have some visuals to grab on to.

For your namespaces analogies, the 3rd grader bus paragraph had plenty of character, but I found it distracted from the point. Maybe you could merge that seat space conflict analogy with your second namespace analogy by focusing on school buses. Multiple buses: there can be people with the same name, but on different buses, etc.

I think the namespace section points out a tricky balance you are trying to strike. In namespace, you are referencing things like ofBackground and glBlendMode for the benefit of advanced readers, but also trying to not overwhelm readers who don't yet know what a variable or function is. Another example of this is Fig 10 where you are introducing types and functions before handling variables. You've set up a flow where you explain every line in the hello world code before really getting into variables.

One approach to tailoring that balance to beginners might be to lead the chapter with variables (logic of single lines of code), then work your way into functions (chunks of code), then all the other goodies like precompiling, namespaces, etc. That would just require letting the reader know to ignore #include <iostream.h>, using namespace std; for the moment and just focus in on what is happening within the { }. Then the concepts reveal themselves in a way that allows them to build upon each other (or at least, that's how I imagine it happening in the brain of someone just learning to code).

Anyway, those were the big notes that I wrote down while reading. I'll throw in some inline comments into your chapter for smaller things. Again, chapter is great so far!

kaylalewis commented 10 years ago

I just went through this chapter too, and I commend you for your thorough explanations of C++. I can't even imagine how much time was spent on this. I have some feedback concerning the nature of the chapter itself:

Maybe instead of a “how to read the book” disclaimer in the C++ chapter, we should add it before the chapters even begin.

The lead up to this chapter is a good story, and I think backgrounds on all of the writers and how/when coding became interesting to them could be a great component to this book. I think it should be included elsewhere. If one author does it, then they all should.

The structure of this chapter is questionable. Talking about functions, and then suddenly delving into a history of programming languages threw me off. History is best served at the beginning. It gives C++ more of a personality and a tangible backdrop.

That being said, the level of explanation that C++ can reach in one chapter of a book is problematic. I think a consensus needs to be reached for just who will be reading this book and how much outside reference they’ll need concerning C++. It isn’t something that can be successfully covered for a newcomer in one chapter. If this book is about openFrameworks, starting with a long, dense C++ chapter seems like it might deter a lot of people.

Maybe this chapter should be C++ basics in relation to oF. For example, how does a function’s syntax look in oF specifically? I’d refer people to some books on C++ alone in the beginning of the book, and then structure any C++ explanation around and within openFrameworks, because this is a book about openFrameworks, right?

Breaking this chapter down into three or four separate ones seems fitting. If someone knows nothing about C++ when starting this book, this is 100% the most complex learning experience in the entire book. Having functions, loops, variables, etc. all sandwiched into one chapter doesn’t work if the goal of this book to cover C++ and hold everything a new programmer needs to know in its pages. So who is the target audience?

Pop culture references made it more engaging and relatable. I could tell you were having fun writing with them, and that made me want to keep reading. Getting people to relate to dense subject matter is a skill, and readers can tell when an author is bored. I never felt like you were bored. Impressive.

I hope this feedback is helpful. This chapter is tricky and definitely stands out next to the rest subject-wise.

ofZach commented 10 years ago

I was also wondering if this chapter would make sense to be split, just to make it more manageable in terms of size / scope. we were aiming for 15-25 pages per chapter...

jtnimoy commented 10 years ago

many thank yous

jtnimoy commented 10 years ago

re: web app to run ascii animation frames, that sounds great. you've got me reconsidering the problem in ideone and the Sphere Engine has a pay-as-you-go plan. i'm thinking a small front-end with a tiny canvas would work, but i would not want to create a new expense.

mikewesthad commented 10 years ago

I haven't used sphere engine before, have you? It looks like it might be too expensive and/or too limiting. The lowest plans are all >= $99 per month and limit you to 15 code submissions per minute.

The most cost efficient route seems like it would be to have some quick js+html that would allow for readers to copy ideone output, paste it into one textbox and watch it render in another textbox.

Then again, maybe this discussion is better to have when ofBook is closer to done.

jtnimoy commented 10 years ago

i took some time to prototype a web app client for the Sphere Engine using twitter bootstrap, codemirror, and processingJS. Here are some screenshots. My goal was to remove the overwhelming flash banners and clear out some of the more esoteric features (in particular, the presence of other languages, and overly verbose reporting). I added a console output mode that renders the ascii text as pixel values. I think the brightness of the pixels need to be based on #=black and [space]=white as in Paul Bourke's character ramp. http://paulbourke.net/dataformats/asciiart/

The display will automatically wrap when it reaches the bottom, and carriage returns work.

image

image

image

Even working with my own API key in the free "pay as you grow" tier, I am finding myself regularly throttled. I could ask each user to go make a free account on ideone.com and get their own API key.

It's a cute concept but could take time away from my working on the actual writing of the chapter content, so i'm going to de-prioritize it all the way to "stretch goal" until further notice.

I got the idea of data interpretation tabs from some hex viewer that had everything and the kitchen sink. I would imagine adding more data interpretations to the console output in the future - granular and/or MIDI sound.

jtnimoy commented 10 years ago

re making the bouncing ball animation look more convincingly locomotive, I am considering telling the reader to print the output, cut it out with scissors as a paper strip, and construct a DIY zootrope out of some thread.

mikewesthad commented 10 years ago

Very cool, but agreed on de-prioritizing it for now.

I'm adopting your approach of giving the reader optional challenge/extension exercises. I very briefly toyed with the idea of a companion site where readers could submit and share extensions. I'm similarly dropping it to the bottom of the list (if not completely off the list) for the same reasons. I think the idea of having these sorts of companion sites is cool. But it potentially complicates ofBook (for us and the reader), and it would divert efforts from making a "book."

ofZach commented 10 years ago

hey @jtnimoy thanks for making the smaller excerpt ! -- it really fits with the book and is helpful. my only feedback from a quick once over is about variables. you currently end with a discussion of a kind of obscure point about operators (postfix vs prefix). I wonder if there's not room to cover quickly basic data types and scope, which I think are pretty important and probably v. useful to know about.... Also, one thing that is crucial is how variables in c / c++ have no default value. This trips up alot of folks coming from java / p5.

jtnimoy commented 10 years ago

Hi Zach, no problem on the shrink down. I can definitely pull the sections you mentioned from the unabridged side. It would increase the page count, and I'll announce how many pages were gained by it.

At this point, I'm ambivalent about deadlines because I've lost track of the schedule. Where can I look, or what keyword can I use to mine my gmail?

thanks J

On Thu, Apr 3, 2014 at 9:20 AM, ofZach notifications@github.com wrote:

hey @jtnimoy https://github.com/jtnimoy thanks for making the smaller excerpt ! -- it really fits with the book and is helpful. my only feedback from a quick once over is about variables. you currently end with a discussion of a kind of obscure point about operators (postfix vs prefix). I wonder if there's not room to cover quickly basic data types and scope, which I think are pretty important and probably v. useful to know about.... Also, one thing that is crucial is how variables in c / c++ have no default value. This trips up alot of folks coming from java / p5.

Reply to this email directly or view it on GitHubhttps://github.com/openframeworks/ofBook/issues/31#issuecomment-39471979 .

ofZach commented 10 years ago

I think we will send out a revised schedule shortly -- a few deadlines have passed on getting chapters done but I don't think you need to worry about that. At this point we are just trying to pull a few of the straggling chapters along and get everyone caught up. I feel like most chapters are in reasonable shape with a few outliers. If you could get your changes in the next week it would be great.

tpltnt commented 9 years ago

@jtnimoy did you push the changes @ofZach mentioned? If so this issue should be closed.