110 stories
1 follower

I'm Loyal to Nothing Except the Dream

5 Comments and 11 Shares

There is much I take for granted in my life, and the normal functioning of American government is one of those things. In my 46 years, I've lived under nine different presidents. The first I remember is Carter. I've voted in every presidential election since 1992, but I do not consider myself a Democrat, or a Republican. I vote based on leadership – above all, leadership – and issues.

In my 14 years of blogging, I've never written a political blog post. I haven't needed to.

Until now.

It is quite clear something has become deeply unglued in the state of American politics.

As of 2017, the United States, through a sequence of highly improbable events, managed to elect an extremely controversial president.

A president with historically low approval ratings, elected on a platform many considered too extreme to even be taken literally:

Asked about Trump’s statements proposing the construction of a wall on the US-Mexico border and a ban on all Muslims entering the country, Thiel suggested that Trump supporters do not actually endorse those policies.

“I don’t support a religious test. I certainly don’t support the specific language that Trump has used in every instance,” he said. “But I think one thing that should be distinguished here is that the media is always taking Trump literally. It never takes him seriously, but it always takes him literally.”

The billionaire went on to define how he believes the average Trump supporter interprets the candidate’s statements. “I think a lot of voters who vote for Trump take Trump seriously but not literally, so when they hear things like the Muslim comment or the wall comment their question is not, ‘Are you going to build a wall like the Great Wall of China?’ or, you know, ‘How exactly are you going to enforce these tests?’ What they hear is we’re going to have a saner, more sensible immigration policy.”

A little over a week into the new presidency, it is obvious that Trump meant every word of what he said. He will build a US-Mexico wall. And he signed an executive order that literally, not figuratively, banned Muslims from entering the US — even if they held valid green cards.

As I said, I vote on policies, and as an American, I reject these two policies. Our Mexican neighbors are not an evil to be kept out with a wall, but an ally to be cherished. One of my favorite people is a Mexican immigrant. Mexican culture is ingrained deeply into America and we are all better for it. The history of America is the history of immigrants seeking religious freedom from persecution, finding a new life in the land of opportunity. Imagine the bravery it takes to leave everything behind, your relatives, your home, your whole life as you know it, to take your entire family on a five thousand mile journey to another country on nothing more than the promise of a dream. I've never done that, though my great-great grandparents did. Muslim immigrants are more American than I will ever be, and I am incredibly proud to have them here, as fellow Americans.

Help Keep Your School All American!

Trump is the first president in 40 years to refuse to release his tax returns in office. He has also refused to divest himself from his dizzying array of businesses across the globe, which present financial conflicts of interest. All of this, plus the hasty way he is ramrodding his campaign plans through on executive orders, with little or no forethought to how it would work – or if it would work at all – speaks to how negligent and dangerous Trump is as the leader of the free world. I want to reiterate that I don't care about party; I'd be absolutely over the moon with President Romney or President McCain, or any other rational form of leadership at this point.

It is unclear to me how we got where we are today. But echoes of this appeal to nationalism in Poland, and in Venezula, offer clues. We brought fact checkers to a culture war … and we lost. During the election campaign, I was strongly reminded of Frank Miller's 1986 Nuke story arc, which I read in Daredevil as a teenager — the seductive appeal of unbridled nationalism bleeding across the page in stark primary colors.

Daredevil issue 233, page excerpt

Nuke is a self-destructive form of America First nationalism that, for whatever reasons, won the presidency through dark subvocalized whispers, and is now playing out in horrifying policy form. But we are not now a different country; we remain the very same country that elected Reagan and Obama. We lead the free world. And we do it by taking the higher moral ground, choosing to do what is right before doing what is expedient.

I exercised my rights as a American citizen and I voted, yes. But I mostly ignored government beyond voting. I assumed that the wheels of American government would turn, and reasonable decisions would be made by reasonable people. Some I would agree with, others I would not agree with, but I could generally trust that the arc of American history inexorably bends toward justice, towards freedom, toward equality. Towards the things that make up the underlying American dream that this country is based on.

This is no longer the case.

I truly believe we are at an unprecedented time in American history, in uncharted territory. I have benefited from democracy passively, without trying at all, for 46 years. I now understand that the next four years is perhaps the most important time to be an activist in the United States since the civil rights movement. I am ready to do the work.

  • I have never once in my life called my representatives in congress or the house. That will change. I will be calling and writing my representatives regularly, using tools like 5 Calls to do so.

  • I will strongly support, advocate for, and advertise any technical tools on web or smartphone that help Americans have their voices heard by their representatives, even if it takes faxing to do so. Build these tools. Make them amazing.

  • I am subscribing to support essential investigative journalism such as the New York Times, Los Angeles Times, and Washington Post.

  • I have set up large monthly donations to the ACLU which is doing critical work in fighting governmental abuse under the current regime.

  • I have set up monthly donations to independent journalism such as ProPublica and NPR.

  • I have set up monthly donations to agencies that fight for vulnerable groups, such as Planned Parenthood, Center for Reproductive Rights, Refugee Rights, NAACP, MALDEF, the Trevor Project, and so on.

  • I wish to see the formation of a third political party in the United States, led by those who are willing to speak truth to power like Evan McMullen. It is shameful how many elected representatives will not speak out. Those who do: trust me, we're watching and taking notes. And we will be bringing all our friends and audiences to bear to help you win.

  • I will be watching closely to see which representatives rubber-stamp harmful policies and appointees, and I will vote against them across the ticket, on every single ticket I can vote on.

  • I will actively support all efforts to make the National Popular Vote Interstate Compact happen, to reform the electoral college.

  • To the extent that my schedule allows, I will participate in protests to combat policies that I believe are harmful to Americans.

  • I am not quite at a place in my life where I'd consider running for office, but I will be, eventually. To the extent that any Stack Overflow user can be elected a moderator, I could be elected into office, locally, in the house, even congress. Has anyone asked Joel Spolsky if he'd be willing to run for office? Because I'd be hard pressed to come up with someone I trust more than my old business partner Joel to do the right thing. I would vote for him so hard I'd break the damn voting machine.

I want to pay back this great country for everything it has done for me in my life, and carry the dream forward, not just selfishly for myself and my children, but for everyone's children, and our children's children. I do not mean the hollow promises of American nationalism

We would do well to renounce nationalism and all its symbols: its flags, its pledges of allegiance, its anthems, its insistence in song that God must single out America to be blessed.

Is not nationalism—that devotion to a flag, an anthem, a boundary so fierce it engenders mass murder—one of the great evils of our time, along with racism, along with religious hatred?

These ways of thinking—cultivated, nurtured, indoctrinated from childhood on— have been useful to those in power, and deadly for those out of power.

… but the enduring values of freedom, justice, and equality that this nation was founded on. I pledge my allegiance to the American dream, and the American people – not to the nation, never to the nation.

Daredevil issue 233, page excerpt

I apologize that it's taken me 46 years to wake up and realize that some things, like the American dream, aren't guaranteed. There will come a time where you have to stand up and fight for them, for democracy to work. I will.

Will you?

[advertisement] At Stack Overflow, we help developers learn, share, and grow. Whether you’re looking for your next dream job or looking to build out your team, we've got your back.
Read the whole story
386 days ago
Share this story
5 public comments
369 days ago
Sharing, in case it causes one more person to read and be moved to do more than complain on the internet. Really a powerful essay.
Portland, Oregon, USA, Earth
371 days ago
This is incredible and considering the source, it's going to be read by a lot of people.
The Haight in San Francisco
383 days ago
… but the enduring values of freedom, justice, and equality that this nation was founded on. I pledge my allegiance to the American dream, and the American people – not to the nation, never to the nation.
Mainz, Deutschland
385 days ago
And the nerds start to get a little more woke.
386 days ago
Powerfully well said.
Atlanta, GA

Too Short a Season - 1.16


Ugh I’ve been sick ALL WEEK and the only productive thing I’ve managed to make myself do is to watch this episode. This is one of those sneaky eps that from the description doesn’t seem like it’ll have a lot of fashion, and then lo and behold, there are some real zingers there! We start off with the Enterprise picking up an old admiral who is supposedly some whiz hostage negotiator.



No, no, it’s Admiral Mark Jameson sitting in front of a backdrop of some really nice Hanukkah wrapping paper.

Anyway, he old, right, though clearly that is some age makeup I WONDER WHY. Anyway, onto his outfit in a second… the important thing early on to know is that this guy is going to be HIGH MAINTENANCE and makes all sorts of demands on Picard before he even gets on the ship. P-Stew gives us some middle-manager realness face here though so it’s all good.


Subtle facial expressions of Picard: Translated

So our guy is like “I’ll beam over at 1500 with my wife” and Data’s like, “Captain it’s 1500 RIGHT NOW” so Rikes and JLP book it to the transporter room.


Professor X and Mystique look turbs

I mean, I think we can all agree that this dude is indeed in Charles Xavier’s chair, right? As for the outfits, I think we need to consider them separately, but we’re not going to see this traveling hood again, so let’s just say that thing looks hella soft and will not protect her from any of the elements. Okay.


THUNDERBIRDS have not aged well…

Right though? I mean, he looks like great-great-grandpa Tracy (I did have to look that up), complete with strings, single movement mouth, and eyes that move before the head does.

As for the Admiral’s outfit, we know that these were revised in later seasons, and it’s probably for the best, as it looks less like something denoting seniority (shoulder pads necessary for that) and more like pajamas you might find at Prince’s house. Clearly there’s a more gold = more fancy idea going on here, but it’s just too much. Contrast this with the outfit worn by the Admiral who kicks off Episode 5.19 and I think you’ll agree. Plus, this outfit has the black spike pointing diagonally at the guy’s left hip, a kind of ’80s asymmetry hangover, whereas the later admiral has her spike pointing directly to her crotch, a.k.a., her Power Box. 

Oh, also, his rank looks like a space harmonica.

Of course, something is UP and guess who can sense it.


Executive from the neck down, reject Leia ’do from the neck up

This is one of my favorite Troi looks from the early seasons, especially with the whole “my hair is a pile of rubies” setup. YOU KNOW WHAT, DEANNA, YOU’RE NOT WRONG. I want a suit made out of that fabric. I’m sure it exists. Bonus points for matching lip color to hair accessory.

She’s not the only one who’s suspish about this guy.


Sometimes the only way to get the captain to pay attention to you is to shoot him a FULL REBA.

Again, standard setup, but Crusher is working everything she’s got. This is also during the period of the show where the doc wasn’t entirely sure that Picard was taking her seriously because of their #baggage. I wouldn’t want to be on the other end of that stare… or would I??? (I would.)

The other major fashions belong to the Admiral’s wife, Anne. Let’s get another shot of her traveling outfit.


Sorry, I went a little crazy in Taos.

It’s hard to really know what’s happening here but I think I like it?! That blue is a real good blue, and the patterns keep it interesting. That necklace has a touch of Klingon craft-market but since it matches the dress I’m going to allow it. 

In other news what the fuck is that … plant? … on the shelf behind her? I know Guinan’s not in this episode but


What else does that outfit have going for it?


You can ring be-e-ell (sleeve) ring my bell (sleeve)

I don’t actually know if this is a bell sleeve, though I did try and do some sleeve research to figure it out. My best guess is that it’s somewhere between a long butterfly, a bell or some sort of glorified cape sleeve, but either way, LOOK HOW SHINY! I dig it.

Girlfriend only brought ONE other outfit for this trip so we might as well look at that now.


What I’m trying to tell you is that this dress is trying to strangle me.

Not quite as successful as the blue getup, I’d argue. It looks like an outfit that came out of a sewing challenge on RuPaul’s Drag Race from one of the queens who don’t know how to sew. (Also if you find out you’re going onto Drag Race and don’t take a crash course in sewing, I don’t even know what you’re doing there.) The colors are nice kind of the way Olive Garden is nice, i.e., as long as you don’t think about it too much. 

I’ll be honest, I kind of hate it. She does have a weird brooch on that you can’t really see in this shot.


In my off-hours I’m a jewelry display stand in Taos

We can all agree that she’s just pinned a pair of earrings to her shoulder, right? Great. Let’s move on.

So this crippled, aged Admiral is supposed to basically be dying of… Iverson’s Disease? Yes that’s right. Except he starts doing WEIRD THINGS. 


He can walk? He can walk! He can walk? He can walk! I CAN SIIIIIIING!

Oh and this also happens:


Subtle facial expressions of Picard: Translated, continued: #DAFUQ?

So the admiral has found some magic potion from some peoples somewhere that helps him age backwards. To make a long story short:


Can we get Val Kilmer? No? Then get his knockoff equivalent!

Fortunately there were no unanticipated side effects from this extremely unreliable and essentially magic process, thank goodness.

Oh, wait.


If Guinan had been there it would have been an episode of The View.

So Bev has to break the news to Anne that her hubs is dying. But unfortunately he’s also cray and also is the highest ranking person on the starship, which becomes problematic when he commandeers an away team to try and blast the hostages out instead of negotiating. How does this go?


Category is: Dirty Stormtrooper

There’s a moment right before this where Geordi is like “Wait, I see some infrared beams with my Visor, let’s be careful” and then literally there are like eight of these guys shooting at them. EYES ON THE PRIZE GEORDI. Wait, is that disablist? I apologize. Visual cortex on the prize.

Who’s this punk who’s keeping these hostages?


Tie-dye military cargowear is VERY in right now.

I don’t know exactly what this would help camouflage him in front of… a field of lavender? Rubble under a VERY strong blue filter? Also look at all those buttons! Clearly not an advanced race. Let’s get a closer look at those medals.



They’re not even *very good* Tetris medals. Anyway, this is from a final tense scene where Jameson and this guy HASH OUT some HISTORY.


Aging backwards makes you sweat A LOT

I feel for any actor who has to die on screen, because, like, you just have to make it up? Anyway, this guy is doing the best he can, but yeah he gonna die.


This tableau feels almost Christlike until you make it to P-Stew’s facial expression


Read the whole story
735 days ago
Share this story

XKCD Stack

5 Comments and 18 Shares
This site requires Sun Java (32-bit) or higher. You have Macromedia Java¾ (48-bit). Click here [link to java.com main page] to download an installer which will run fine but not really change anything.
Read the whole story
749 days ago
Share this story
4 public comments
750 days ago
"A dev typing really fast"
The Belly of the Beast
753 days ago
I want Microsoft Bob Server. Now.
753 days ago
Also, I'm disappointed that Hypercard.js isn't a thing. Someone needs to get on that.
754 days ago
Oh man. It would be utterly horrifying / hilarious for someone to try and take a single big VFX shot and actually write down the ENTIRE stack that generated the final image.
Los Angeles, California, USA
754 days ago
I literally recoiled a bit at the MongoDB/Excel layer
Baltimore, MD
754 days ago
What's wrong with MongoDB? I heard it's web scale.
753 days ago
Your reply is stored in it.
749 days ago
Nothing (or at least not too much) is wrong with MongoDB. It's the MondoDB/Excel combination which is terrifying. Are we updating spreadsheets which are stored inside the database?? OR DO WE HAVE A SPREADSHEET WITH A DATABASE SAVED TO EACH CELL??

I Hate the Lord of the Rings

1 Comment and 2 Shares

Today, we're breaking out something a little different. I put this together more for fun than anything else, and we piloted it around in the Side Bar, along with a few other shares.

After some feedback, we're happy to bring this to the front page, and we plan to produce more of videos in this vein as a recurring periodic feature.

Sometimes, it feels like getting our work done is an epic struggle, suitable for retelling by the greatest of bards. And you know what? You're absolutely right. IT is an epic quest- and that's why I can't stand the Lord of the Rings. It's too much like work.

[Advertisement] Release! is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!
Read the whole story
752 days ago
Share this story
1 public comment
740 days ago
I can typing!

Next steps for beginning programmers

1 Share

Last month @zandrmartin asked me on Twitter:

i would love to read a post about things you would recommend newish programmers learn, esp those coming from a php web background

not even tutorials as such, just like ‘you should learn about x and how to implement it effectively’ would be great

like when you were talking about bit masks a while back, i have no idea what those are or why you’d use them, but i want to

I’ve opined on this sort of thing briefly in various impermanent places, but somehow never tried to consolidate it at all. So here you go, some stream of consciousness on being more better at computers.


Can’t really be a programmer without a programming language.

One of the worst things you can do is only learn one language. Solving problems is much easier if you’re used to approaching them from different angles, and that’s much harder to do if your thinking is colored by only a single language’s toolbox. It’s fine to be opinionated, but you only get to have an opinion if you know what you’re turning down.

Or as the saying goes: when all you have is a hammer, everything starts to look like a nail. So expose yourself to as many things as you can, however briefly, just to be aware of what’s possible. Here’s a good spread:

Python is a very good general-purpose language that blends a few different approaches. It’s good for beginners, since it has a fairly low number of confusing hoops to jump through, but it’s plenty powerful enough for large serious projects as well. Be aware that Python 2 and Python 3 are slightly incompatible, but learn Python 3 and roll your eyes at anyone who tells you otherwise.

Shell could mean either the Unix shell family or DOS-style batch files or Windows PowerShell®™. Take your pick, depending on your platform. Either way you are in for a WORLD OF PAIN, because shell languages are a horrible nightmare. Awkward syntax, obscure gotchas, little real documentation because most of what you want to use isn’t actually part of the language. And oh, they’re some of the very few examples of truly interpreted languages, because they’re run in a single pass. So even if you have an egregious syntax error on line 500, you’ll never find out until you actually try to execute that line. Have fun!

C (by which I explicitly mean not C++) is the rough equivalent of a pile of rocks held together with razor wire. It’s tedious to write, extremely difficult to write correctly, and hard to debug. But it’s still the lingua franca (for better or worse), it continues to influence a lot of languages created even now, and if nothing else it’ll give you an appreciation for virtually every other language. Its design also offers a lot of glimpses into how these strange machines operate under the hood.

Any ML will hurt your brain in a good way. You probably want Haskell, which isn’t really an ML, but it’s close enough. It’s a pure functional language, which means… a lot of things that you’ll learn about very quickly. It’s extremely different from any of the above languages and will force you to approach problems from a very different angle.

Prolog is even more different than any of the above languages — it’s entirely declarative, meaning that you list facts rather than issue commands, and trust the language to figure the rest out. It’s definitely, ah, quite an experience.

This list is not exhaustive! I would definitely recommend reading up on lots of languages even if you don’t give them a shot yourself. For historical and cultural reasons, you might also want to try out Smalltalk and a Lisp variant. Smalltalk introduced object-oriented programming; Lisp introduced dynamic typing. Both of them have fairly unique syntax. You might also want to try Rust to cleanse your palate after using C; it’s a new systems language from Mozilla that does away with a lot of C’s sharp edges. And less seriously, there’s APL, which is at least notable for being the only programming language to have Unicode characters dedicated explicitly to it.


Is an arbitrary mess, which hopefully you will learn really quickly on your tour through half a dozen languages. C++ calls everything “member”, a word that is meaningless to virtually everyone else. Most languages have “methods”, but you may encounter people who consider “methods” uniquely distinct from “functions”, or who think all “functions” are actually “methods”. Python has “attributes”, but everyone is constantly tempted to call them “properties”, which are actually something slightly different. A “float” in C is a numeric type of a particular size, but a “float” in Python is a numeric type of a different size, and “float” may also be short for “floating-point”. Many languages have “classes”, but Haskell and some others have “typeclasses”, which are mostly entirely different. C has “casts” and “conversions”, but everyone mixes them up all the time, even in languages that don’t have casting. “Strong typing” is a compliment given to Python, but “weak typing” is an insult used on Python. Perl has its own entire lexicon. Programming language theorists barely even speak English, what with their “covariance” and “higher kinds”.

So don’t be afraid to ask what people mean (or think they mean) with some term. Don’t be surprised if different communities use different words, or different meanings for the same words. And don’t get too attached to the terminology — the ideas are what’s actually important. (I’ve often seen beginners ask for help and use a lot of jargon that doesn’t quite mean what they think it does, which just confuses everyone.)


Something I frequently see new programmers trip over (but few resources address) is confusing data and its representation. A common example is someone using Python 2 who sees some string printed as u'foo', and asks how to “remove the u”. Of course, the “u” isn’t actually part of the string — Python uses it in debug output to indicate that this is a Unicode string, the same way you’d indicate that in source code. Similarly, "\x20" is only one character, dict(x=1) is equivalent to {'x': 1}, and "\"foo\"" does not contain any backslashes.

This may sound trivial, especially to non-beginners, but it’s exactly the same kind of pitfall as not understanding text versus bytes. Text is a sequence of characters, whereas bytes are units of memory. If you’re used to ASCII, then there’s no distinction here, because any one ASCII character will fit in one byte. But plenty of other characters don’t fit in one byte, so we need to find a way to fit them in multiple bytes, and we call those ways character encodings. It’s really no different from how the number 500 might be stored in four bytes as f4 01 00 00, or as 00 00 01 f4, or in some other order, or in some other number of bytes.

Speaking of which, another good thing for beginners to learn about is Unicode! I’ve written about some curiosities in Unicode before, though that’s not necessarily aimed at beginners.

Along similar lines, general problem-solving is always useful in programming. I don’t think you can just pick up a book and read about it, but it’s good to pay attention to how you approach problems and see what gets you the furthest in the least time. Off the top of my head:

  • Question your assumptions. If everything looks right but the code still doesn’t work, you’re wrong about something you thought you were right about, and now you have to figure out what it is. Start with whatever you’re least confident about and work from there. (If you conclude there’s a bug in your programming language or operating system, chances are you overlooked something you did.)
  • Avoid the XY problem, where you end up sidetracked by a different problem that poorly fixes your original problem, just because you think you have a better chance of figuring out how to solve it.
  • Fix the source of a problem, not its fallout. The question of “removing the u” above is a great example; if that “u” appears somewhere it shouldn’t, you need to fix whatever’s spitting out debug information where it shouldn’t be. I’ve also seen a lot of people ask how to flatten a list in Python — that is, turn [1, 2, [3, 4]] into [1, 2, 3, 4] — and the right answer is usually to avoid creating a partly-nested list in the first place.

Ah, let’s see. Less abstractly…

Indirection is super duper important, because programmers love to solve problems by adding indirection. If you work with C or a similar language, indirection is everywhere in the form of pointers. In other languages it might exist as weak references, wrapper objects, referring to objects by keys in a dict, or even just creative uses of lists.

Somewhat related is abstraction, which is like handwaving.

You should understand various data structures — not necessarily how to make them from scratch, but how they work and when to use them. Lists (or arrays, see above about terminology), dicts (or hash tables, ahem), sets, queues, stacks, trees. Bitfields fall under this umbrella too, as they’re really just a specific way to pack a set into a very small amount of space.

If your language has them, look into metaclasses. Objects and values have a type, right? If types are a kind of value in your language, then what’s their type? The answer is a metaclass, and if you’re lucky you can write your own and do all kinds of confusing shenanigans. Your work is done when you can explain why isinstance(object, type) and isinstance(type, object).


Learn source control. It is invaluable, even if you only use it to undo a change that you realize isn’t going to work. Git is hecka popular and well-supported by GitHub, but there are others as well, like Mercurial. If you’re feeling confident you might even stick your code on GitHub or Bitbucket, where other people can see it and give you a hand. You could even find another beginner and work on something together.

Write tests. The goal of tests is to make sure that in the future, when you rejigger your code, it still works the way you want it to. This is a huge and complex topic, but even one test is a good start (and better than none). I don’t know of any good introductions to testing off the top of my head, but the documentation for the (excellent) py.test test runner has lots of examples of what simple tests might look like.

Use a bug tracker to keep track of what you plan to do. You could use the issue tracker on a host like GitHub (even if you don’t actually publish your code), or you could just keep a list in a text file (but make an effort to keep it organized). Ideally, find someone else to collaborate with, so you actually have to make an effort to communicate your plans. It might seem like pointless effort for a small project (and it kind of is), but it’s good to get used to.

Get familiar with IRC, because most languages and open source projects have support channels on Freenode.


Some interesting exercises, again kind of off the top of my head, which should help you cram more things into your brain.

In general, the best way to learn anything is to keep doing things you don’t know how to do. The downside is that you spend a long time feeling like an idiot, because you’re constantly bad at everything, because you keep only doing things you’re bad at. The upside is that one day you wake up and discover you’re pretty okay at a whole bunch of things, and even things you’re bad at now come more easily.

With that in mind, here are some things you hopefully don’t know how to do, broken into individual pieces you don’t know how to do.

Write a calculator

You can do this entirely from a terminal.

  1. Prompt separately for a number, an operator, and another number. One per line. Compute the result and print it out.

  2. Prompt for them all on one line, like 2 + 3. But 2+3 should also work.

  3. Extend it to work with two or three numbers, so 1+2+3 works as well.

  4. Now take order of operations into account, so 1+2*3 produces 7, not 9.

  5. Support negative numbers. You have to figure out whether - is subtraction or negation.

  6. Make it work for any number of numbers. One number is a valid calculation, remember — 5 just evaluates to 5.

    Hint: If you have trouble, add manual support for four or five numbers first, then look at all the cases you have and see what common code you can turn into loops or functions.

  7. Finally, add support for parentheses, which can be nested arbitrarily deep.

    Hint: either recursion or a stack will be very very helpful. Try to figure it out yourself! It’s very rewarding if you do.

Write tests as you go, so you can be sure you don’t break something accidentally.

Write a text adventure

You know. Like Zork. West of a white house? Likely to be eaten by a grue? Jeez, kids these days.

Okay well these are games that are entirely text-based. Even the player’s actions are entered as commands, not by clicking or choosing from a menu. So you might take rock or eat sandwich. If you’ve really never experienced this genre (the predecessor to point-and-click adventures!), consider playing some of these introductory games to get a feel for what they’re like.

So, games are an excellent exercise; simulating a world is surprisingly finnicky, and most programming languages aren’t particularly good at it, so you have to get a little creative if you don’t want your code to be a huge mess. Text adventures have many of the same problems to solve, but without making you worry about how to find graphics or sound. Plus, the player’s commands are an open problem — you can get as fancy as you want in trying to understand what a human might type.

Here are some possible steps, but this is pretty open-ended, so feel free to do whatever you want:

  1. Make it possible to look (which should describe the room) and examine (object) (where the possible objects are mentioned in the room description). You can even hardcode the exact commands at first.

  2. look automatically when the game starts, as is tradition. Make it possible to win. The only action the player can perform right now is looking at stuff, so that’s the only way they can win, but you can jazz it up a bit by e.g. only mentioning the winning object in the description of another object. Congratulations, you’ve written a game!

  3. Give the player an inventory, let them check it with inventory, and let them take and drop objects. Be sure to deal with objects that can’t be taken, like a desk or the sky. Change the win condition so the player has to take the right object, not just look at it.

  4. Spruce up your command parsing a bit. Add some command aliases, and let the player use “the”. So if you understand take rock, you should also understand t rock, or take the rock. i and inv are common aliases for inventory, as well. Think about possible aliases when you add new commands in the future.

  5. Make it possible for objects to contain other objects. (Hint: this is just like having an inventory.) Now the player needs to be able to put (object) in (other object), which means your parser has to get a little more clever. Change the win condition so the player has to put a specific item in a specific container.

  6. Add a second room, and let the player move between rooms. A common way to do this is with compass directions like go east (or east, or e), but do whatever you want. Now you have to make sure the player can only interact with objects in the room they’re in. Change the win condition so the player has to carry an object from one room to the other.

  7. At this point your code is probably a huge mess of ifs, so stop for a moment and think about how you might clean it up. Are there any repetitive bits you could pull out into functions? Are there any clusters of variables that might work better as objects?

    Ideally, you want to separate your particular game from the code that runs it. The line is blurry, and it’s up to you where to draw it, but you want to be able to make a second game with the least amount of effort (and least amount of copy-pasting).

  8. There are lots of things you can do from here, depending on how ambitious you feel.

    • Support other actions on objects, like eating or drinking or waving or turning. (How do you describe what to do when a particular object is eaten? What do you do when the player tries to eat an object that’s inedible?)
    • Support objects with states, like a lamp that can be turned on or off, or a drawer that can be open or closed.
    • Support objects that specifically interact with each other to do something other than win the game. Perhaps a drawer can only be opened once it’s been unlocked with the right key.
    • Have a room or object’s description show different text the first time the player examines it.
    • Support saving and loading the game, or undoing the last action.

Write something with a UI

Throw it on top of one of the previous projects, even.

A UI could be anything: a Qt GUI, a terminal UI, an Android app, a client-side Web app, whatever. The point of this exercise is that dealing with real-time user input adds all kinds of little wrinkles. How do you make sure the user can only do things that make sense at any given time? How do you make it possible to cancel something in the middle of doing it, or do things in any order? How do you implement undo, or autosave? How do you make your program flexible without overloading the user with trivial choices?

Write something that does networking

IRC bots are basically rites of passage, and come with some new and interesting concerns.

  • You’re running a program that’s exposed to the Internet and everyone on it. Some of those people are total assholes. How can you be sure those assholes don’t break your program — or worse, use your program to break your computer?
  • What do you do when your bot gets disconnected? If you reconnect, how often do you retry, and when do you give up?
  • What do you do if your bot gets flooded with too many commands?
  • If your bot does something that involves talking over the network to something else, like finding the titles for YouTube links (and it totally should do something like that), how do you deal with a slow server? If you’re waiting too long on YouTube, other commands won’t go through, or you might get disconnected from IRC!
  • How do you connect your bot to more than one server at a time?
  • How do you make it easy to configure your bot?

Free hint: don’t use sockets. And if your language allows, don’t use threads either. See if you can find an async library. Python has Twisted, the newly builtin asyncio, and much more recently async and await; JavaScript is only async; .NET languages have async and await built in; Perl has POE and AnyEvent but I don’t know if they’re any good. I can’t think of any others off the top of my head, but async programming is reasonably popular lately, so there oughta be something.

Contribute to open source

Chances are, you’ve used something that’s open source. If you use Firefox, Mozilla goes out of its way to help newcomers contribute. Most of Chrome’s source is available, so you could try that too. Most programming languages are open source, and most libraries are open source as well. All my work is open source. GitHub has pages for browsing through popular projects. Take your pick, find a bug or missing feature, and just go take a crack at it.

Besides the hands-on experience and learning to work within someone else’s workflow, this will give you the chance to experience some of the gritty squishy human parts of Real World Programming™:

  • Getting work done without trampling all over work someone else is doing, or having your work trampled
  • Dealing with grouchy maintainers who won’t just merge your damn pull request
  • Working alongside people who are obviously way smarter than you and can’t seem to explain anything without using a lot of words you’re pretty sure they made up
  • Finding out that your brilliant and elegant solution to a problem literally only works on your machine and no one else’s
  • Doing a lot of hard work only to be subtweeted by jerks on Twitter

I’m only half kidding. Knowing how to interact with a larger organization (for varying values of “organization”) is pretty helpful, especially if you want to make a career of programming, and it’s not always sunshine and rainbows.

Towards the future

The sky’s the limit! Do what you enjoy.

But while you’re here, I have a few things that could use your help

Read the whole story
860 days ago
Share this story

A game of one-upmanship between a graffiti artist and the city of London, in photos

1 Share

A street fight doesn’t need to be violent—heck, it doesn’t even need people. In this series of photos, UK graffiti artist Mobstr pits spray paint against the cleaning tools of East London street washers, to claim a city wall.

“I noticed that graffiti painted within the red area was ‘buffed’ with red paint. However, graffiti outside of the red area would be removed via pressure washing,” explains Mobstr on his personal website, about the electrical substation that he had cycled past for years. Just to see what would happen, Mobstr tagged the word “RED” on the wall. Soon it was painted over. Naturally, he kept painting—and so did the cleaners.

“I am glad they were as dedicated to their work as I was to mine,” he told Quartz. The cheeky back-and-forth below concludes with a charming détente.

Read the whole story
957 days ago
Share this story
Next Page of Stories