dargacode

dargacode:

Day 2663

Here’s a great explainer for Debounce vs Throttle, which are two different ways of making sure a user can’t run a piece of code too frequently by spamming.

The little interactive examples where they have you click and count the function executions are really great.

dargacode
dargacode

dargacode:

Day 2663

Here’s a great explainer for Debounce vs Throttle, which are two different ways of making sure a user can’t run a piece of code too frequently by spamming.

The little interactive examples where they have you click and count the function executions are really great.

dargacode

“TUTORIAL HELL” is Both Harmful and Imaginary

Day 2862

Every time I go on a programming subreddit or other public forum, I see so many distraught learners in anguish that they can’t start “A Real Project”, and are “stuck” on tutorials, as state which has now come to be referred to as “Tutorial Hell.”

It honestly makes me extremely mad that people have made Tutorial Hell into such a meme that new programmers are now scared of it. It’s unnecessary gate-keeping around what counts as A Real Project, and it’s harming programming students who could otherwise be happily progressing on their way to mastery if they hadn’t been poisoned by this idea.

There are zero useful aspects to the concept, and it only prevents students from learning rather than helping them learn. Every programmer in the world, from you to the creators of Google, has to get their ideas based on SOMETHING:

  • A problem they want to solve for themselves (or a friend, or a customer).
  • Some knowledge they already had, applied in a new way
  • A new skill they’ve just picked up from another project or lesson
  • A new feature that was just introduced into some technology they use

There’s literally no way to get an idea except to have had some experience that leads you to it.

So starting from a completely empty file, and divining a new project based purely on inspiration is of course a very intimidating task, but luckily we don’t ever actually have to do that.

The process of developing projects is actually very natural (even inevitable???) if you transfer your code more gradually from “100% Tutorial” to “100% Project”:

  1. Start off by doing the tutorials as written. Make sure that you’re actually coding along and checking in your code to a github repo.
  2. Every time you finish a tutorial, think of some tiny change you can make to the code to “make it your own.” This can start out as small as just changing some text on the screen, or the colors it’s using.
  3. Over time you’ll naturally get some more ambitious ideas for how to make the project into something even cooler, and you’ll start adding larger things like a new feature with its own functions.
  4. Eventually you’ll get enough practice expanding projects and applying ideas that the project is mostly your “custom” code instead of code the tutorial told you to write.
  5. Now maybe you have an idea to make a clone of this project but make it even better.
  6. Now you’re making A Real Project, From Scratch, but it doesn’t rely on you having some eureeka moment of inspiration.

Here’s what those steps could look like in a more specific example, from a common tutorial:

  1. Complete a tutorial on how to fetch data from a weather API.
  2. Think, “how could I do some additional fetching to practice more?”
  3. Decide to fetch some data from a movie API instead.
  4. Think, again, “how could I do some additional fetching to practice more?”
  5. Realize that you could use the skills you’ve learned to fetch two different movies, and iterate through the casts to see which actors they have in common.
  6. Think, again, “how could I do some additional fetching to practice more?
  7. Realize that you could do something similar by fetching two actors, and see what movies they have in common.
  8. Remember that the meme ”6 degrees of Kevin Bacon“ is related to actors being in the same movies together.
  9. Realize that you could make an app that tracks Kevin Bacon degrees by putting together your movie overlap code and your actor overlap code.
  10. Take the code you’ve written to modify the tutorial and paste it into a new project, where start turning it into its own app.
  11. https://apps.apple.com/us/app/six-degrees-movie-trivia/id328926385 (not my app)

Coding learners, you’re going to be ok - you can take it gradually! Try to just focus on programming a lot, and what kinds of things you program will evolve naturally over time. If you want to consciously lead things in the direction of building your own projects from scratch that’s great!

But trying so hard to make this transition that it discourages you from coding is hurting you for no good reason. If you stay curious enough and excited enough about programming, over enough time you’ll reach this goal without even trying to.

dargacodeprogrammingcodeblrhighlights

Day 2663

Here’s a great explainer for Debounce vs Throttle, which are two different ways of making sure a user can’t run a piece of code too frequently by spamming.

The little interactive examples where they have you click and count the function executions are really great.

resourcesprogrammingdargacodecodeblr

How to see every single orphaned commit in a git repo

Day 2359

This git command shows every commit in your repo which isn’t pointed to by anything:

git log –graph –oneline –decorate –all $( git fsck –no-reflog | awk ’/dangling commit/ {print $3}’ );

Very helpful for when something has gone horribly wrong, like say if you dropped the wrong git stash with important stuff in it 😅

Stack Overflow Thread

gitresourcesprogrammingdargacodecodeblr
dontcode

dontcode:

Code like a dumbass:

  • Use simple data structures.
  • Use the simplest design patterns.
  • Write simple code.
  • Test your code since you don’t trust your dumb ass to handle all cases.
  • Automate tests since your dumb ass will break the code in the future.
  • Automate linting because you can’t agree with yourself on code style.

Coding like dumbasses, I think, is the only way we can write software that is easy to understand and maintain later.

dontcodeprogrammingdargacodecodeblr

How to tell git to always ignore changes to a file, but only on your own machine

DAY 1567

My project at work has some config files that I need to update locally, depending on what user account id I’m trying to test with, etc. If I ever accidentally checked in these changes, it would break a lot of stuff. 

After some searching I found this command, which makes sure my local changes to the file are never picked up by git:

git update-index –skip-worktree <foo/bar/filename>

https://git-scm.com/docs/git-update-index

gitprogrammingdargacodecodeblr

4 Years of Full-Time Programming!

image

DAY 1462

It’s been 4 years since I sat down to start doing some coding tutorials in the hopes of changing careers. Despite the euphemistic text on my website, this was actually 2 months after I had quit my job, and I had filled that time by agonizing over what I should do, reading a ton of advice on Reddit, and generally procrastinating in any way I could think of. 

Then, I finally forced myself to do the Hour of Code exercises on Khan Academy, and I drew a picture of a chicken. After that I could rely on momentum to move myself to the next project, and the next course, and the next topic, even when I wasn’t sure if it was the right thing to do. 

image

I didn’t recognize it at the time, but that first lesson was the most valuable - STOP WORRYING AND JUST CODE SOMETHING. That’s what always turned out to be the right answer all the way through this studying process, the job application process, and fairly often through my coding jobs as well. 

Any time I go back and think about what I should have done at a particular juncture, the answer of what went well, or what I should have done, was to bias my actions toward having completed another project, or mini-project, or practice question, or even just an experiment in my browser console. 

progresshighlightsmonthlyprogrammingdargacodecodeblr

My biggest lesson so far about writing unit tests

DAY 1283

I’m writing a lot more tests in my new job, and I generally like it a lot, but I’m still very bad at it. 

I find myself pretty frequently in situations where I’m thinking, “How in the world can I possibly test this thing?? It’s gonna be impossible to get at that [state/data/function/whatever]!”

So far every time that has happened, I talk to someone on my team and it ends up I have the wrong idea and definitely shouldn’t be trying to test that thing in that way, or even that I shouldn’t be testing it at all. 

I’m going to try and get better at recognizing this type of confusion earlier on, and saving myself a lot of worries in the future. 

unit testsprogrammingdargacodecodeblr

Why did you want to switch careers from Game Designer to Software Engineer?

DAY 1245

This is another question people ask me a lot.

really wanted to get out of game design, which is a bit sad since so many people think (and my past self thought) of it as such a dream career.

Making the switch took 2.5 years with no income and a big pay cut at first, but even in the first year and month it was a no-contest great decision for me. 

Here’s what I tell my game design friends when they ask me about it:

1. I want there to be a better match between the things I feel responsible for and the things I have agency over. [I’ve always noticed that engineers and artists can still seem to feel the sense of doing good work even if the game overall is not a success.] Game designers have responsibility over the entire game, but in practice not agency to make improvements to the entire game. Engineers also have to ability to fix so many different kinds of problems compared to what a designer can do with pure tuning.

2. I can spend more time focusing on the aspects of game design that I like (implementation, process, solving technical challenges, objective decision making) and less time focusing on the parts I don’t like (creative “brainstorming”, high level theme/audience, subjective decision making).

3. More companies to choose from. I applied to 360 companies in the bay area before I got an offer, and there was no sign of me running out. In games I got to the point where I couldn’t think of a single company I wanted to work for, or if I could it would have meant relocating.

4. More potential to get a job working on issues that I care about/find meaningful. Education, health, civics, etc.

5. More flexibility on places in the US I can live and still be paid well. People on reddit all the time are talking about how ridiculous it is to live in the bay area when they can make 6 figures in much cheaper places, work remotely, etc.

6. Better career progression for someone who doesn’t want to be a manager.

7. More of an established discipline with fewer disagreements about fundamental aspects.

8. Lots of new things to learn, no sense that I can ever start to run out/hit diminishing returns.

9. I felt was fairly topped out in my game design salary as an individual contributor, but that same amount of money is on the low end of what engineers can make.

10. I wanted to see if I could pull it off. It was really scary and awful and satisfying and fun. I would never have thought of something like this in the past but I was lucky enough to have some savings finally, and was also inspired by some friends who talk about things like early retirement and generally just finding another path that makes you happy besides the default one.

askshighlightsprogrammingdargacodecodeblr

What is game economy design?

DAY 1236

This isn’t related to programming, but it’s something that people ask me about all the time, when they hear it used to be my job.

Here’s what I usually tell them:

The game economy generally includes any numerical value in the game, and the economy designer defines and tunes the formulas for all of those numbers.

For example, imagine we’re asked to design a game where the player can hit pinatas to break them open and get candy.

Some of the questions we would want to answer and then provide numbers for:

  • How fast can you swing the club?
  • How much damage does the club do to the pinata?
  • How much damage can the pinata take before it breaks open?
  • Are there different kinds of candy? If so how many?
  • Does the candy have rarities? How easy is it to get a really valuable piece vs the most common ones?
  • Can you eat the candy? If so how does it give you some kind of benefit? How much benefit from each rarity?
  • Can you sell the candy? If so how much is each kind worth?
  • Is there a store you can spend that money on things? If so what can you buy?
  • Can you spend money to upgrade the club we hit the pinata with? What are the new stats and prices for each item?
  • Can we buy pinatas with better contents? If so how expensive is each one and how likely ie each one to give you rare candy?
  • Can the user buy in-game currency with their real-world money? If so at what exchange rate?

For even a simple game like this, the list of questions can just keep growing and growing, until it’s very easy to see how answering them can become someone’s full time job =D

game designasksprogrammingdargacodecodeblr