Motivating examples for beginning coders
One thing I learned from the authors in the Head First series who came before me is the importance of good “motivating examples” - a task that the reader can easily understand but requires learning a whole suite of skills to actually implement (coinciding as closely as possible with the skills you want to teach). Motivating examples are valuable because they give a reader a sense of progress as they work toward a goal.
Rosetta Code is basically a wiki-based collection of motivating examples for beginning developers. There are tons and tons of tasks on there, each showing solutions in a wide variety of programming languages. But a large portion of them aren’t ideal for beginners:
- Many involve advanced math problems, slowing programming learning down with high extraneous cognitive load (if the reader can even understand the problem in the first place).
- Many involve a premise that is not only silly, it takes too long to explain.
- Many focus on details that aren’t important to a beginning programmer.
But there are a lot of great beginner-friendly examples too. I’ve collected promising-looking ones here, for people to mine for inspiration.
- Align columns
- Anagrams
- Averages/Median
- Averages/Mode
- Character codes
- Chat server
- Check that file exists
- Comma quibbling
- Command-line arguments
- Compare a list of strings
- Count occurrences of a substring
- Create an HTML table
- CSV data manipulation
- Echo server
- Even or odd
- File input/output
- File size
- Greatest element of a list
- Guess the number/With feedback
- Hash from two arrays
- I before E except after C
- Input loop
- Leap year
- Letter frequency
- Longest string challenge
- Mad Libs
- Menu
- Morse code
- N'th
- Named parameters
- Number names
- Object serialization
- One-dimensional cellular automata
- Palindrome detection
- Pangram checker
- Password generator
- Percentage difference between images
- Phrase reversals
- Pick random element
- Pig the dice game
- Playing cards
- Plot coordinate pairs
- Rate counter
- Read a configuration file
- Read a file line by line
- Read a specific line from a file
- Read entire file
- Remove duplicate elements
- Remove lines from a file
- Roman numerals/Encode
- Rot-13
- Search a list
- Secure temporary file
- Take notes on the command line
- Temperature conversion
- Text processing/2
- Text processing/Max licenses in use
- Textonyms
- The Twelve Days of Christmas
- Tokenize a string
- Top rank per group
- Unix/ls
- Update a configuration file
- URL parser
- Web scraping
- Word wrap
- XML/Input
- Anagrams
Console family timers
The most recent game console generation (Xbox One and PS4) offers NO parental time limits for kids. Microsoft (and presumably Sony as well) continues to ignore the thousands of requests it’s getting for this feature. The last console to do this (mostly) right, as far as I know, is the XBox 360, with its “Family Timer” feature. This is unfortunate. In my case, it means we’ve been unable to purchase any of the new consoles in order to avoid giving my screen-addicted teenager a constant distraction from homework.
Many parents who ask for a feature like this get accused of shirking their responsibilities. And a timer is certainly no substitute for appropriate supervision. But my teenager knows all the tricks to try and get extra screen time out of me (and my fiancee), and I find that the timer avoids a great many arguments. Time’s up? You’re done playing. No discussion necessary.
I’m putting together this post so that future parents know what they should be able to expect from the parental controls of a game console, computer, etc. I feel it’s needed, because very few manufacturers get everything right (if they even try at all). This will be a “living” post; I intend to update this as new use cases come to light, or as errors are found.
Aspects to look for in a system’s time limit feature
Each entry will be followed by a list of systems that offer that feature.
- Time allowance can be set to renew on a daily or weekly basis. (XBox 360)
- More time can be added at any time, whether because a child legitimately missed some of their screen time or as a reward for good behavior. (XBox 360)
- When time is up, the system doesn’t shut down. Instead, it blocks the screen from being viewed, with the option to add more time. In the event that a child is caught off-guard by time expiring, this allows the parent to give them a few more minutes to save their progress. (XBox 360, Windows 8, Mac OS)
- Can set times of day system can be used to prevent midnight playing. (Windows 8, Mac OS)
- Can suspend timer so others can play without affecting child’s remaining time. (XBox 360)
- Can adjust time remaining (up or down) via web account, so it can be done without interrupting play on the system. (This is a wish-list item, as no system I know of allows this. Windows 8 allows adjustment of overall settings (not time remaining) via a Microsoft web account, but in my experience this feature is completely broken anyway; no limits were enforced until I switched to managing them locally on the PC itself.)
Aspects to avoid in a system’s time limit feature
Each listing will be followed by systems where it’s a problem.
- Can’t set times of day system can be used. (XBox 360)
- Child can easily circumvent it. (On Windows 8, I have to set a one-hour window each day when my son can log in, because he knows how to circumvent the time limit aspect.)
- Can’t modify timer unless time is up. (Mac OS, Windows 8)
- Poor, hard to understand UI. (XBox 360 controls are split between the “Family Safety” and “Preferences”.)
- Not possible to subtract time (except by logging in to let the timer run down, and then watching to ensure the child doesn’t play). If my kid breaks the rules, it would be good to be able to reduce their available time as a consequence. (XBox 360, Windows 8, Mac OS)
- Not enough granularity in allowed time. (Windows 8 only allows time to be set in half-hour increments.)
Readers, your help maintaining this post would be appreciated! If you see an error, or have info on a system that isn’t represented here, please contact me.
Read more...Leveraging Ruby Libraries webcast
Video of “Leveraging Ruby Libraries”, my webcast for O’Reilly, has been posted. It’s a whirlwind tour of some of the cool things you can do with Ruby’s core classes, standard library, and third-party gems.
- Intro
- What is Ruby?
- Installing Ruby
- Syntax basics
- Examples of Core Classes
- Array
- Hash
- File
- Examples from Standard Library
- CSV
- ERB
- YAML
- Examples of Ruby Gems
- lolcat
- Rails
- Sinatra
Just sign up here (make sure to un-check the two boxes so they don’t spam you) and you’ll be e-mailed a link to the presentation immediately.
Read more...A Head First author's guide to InDesign
The InDesign tutorial that I received when starting on my Head First book was helpful, but there were some super-useful InDesign features it didn’t include. I shared this list of my favorites with my fellow authors, and figured I would copy it here…
- Libraries: I set up an .indl file with about 6 objects, each with many embedded and anchored components. Whenever I needed a page element, I dragged and dropped it into place, and deleted the subcomponents I didn’t need. Libraries were probably the single biggest time-saver I discovered. Adobe help: Use Object Libraries
- Anchors: Great for any object that you need to keep its position relative to another object, such as an annotation arrow that you need to point to a particular line of code, or a text box showing output that you need to stay next to a code sample. Adobe help: Anchored Objects I usually use “Custom” positioning, with X relative to the anchor marker, and Y relative to the line the marker’s on.
- Auto-sizing: Almost all your text frames should have auto-sizing turned on, either horizontally, vertically, or both. I set up a library with appropriate text frames I could drag-and-drop, but I believe you can also set up properties for the default text frame. Adobe help: Frame Auto-sizing
- Quick Apply: Select an object, press Ctrl-Enter, and begin typing the name of any menu item, text style name, or whatever else you can think of. It’s like Alfred for InDesign! Better than trying to remember all those complex keyboard shorcuts, and it even lets you use stuff for which no shortcut has been assigned. Adobe help: Quick Apply
- Group objects: Another, simpler way to ensure objects keep their positions relative to each other. Adobe help: Grouping Objects
And remember, search engines are your friend! If there’s something you want to do but you don’t know the name of the feature, just type “indesign” into a search engine, followed by a brief description of what you’re looking for. You’re almost certain to stumble upon a forum post with the answer.
Read more...I'm writing Head First Ruby!
One reason this blog hasn't seen an update in forever is that I've been writing a book! O'Reilly will be releasing Head First Ruby in mid-November.
You can get access to the Early Release right now on O'Reilly's shop.
Or, you can pre-order from Amazon.
Enjoy, and please send feedback!
Read more...