DEV Community

Phil Nash
Phil Nash

Posted on

Those silly mistakes we all make

I've been developing for years. Years! Yet every now and then something that turns out to be simple floors me for just a little bit longer than is comfortable.

Working with code really can keep you humble. What always catches you out or got you stuck recently that really shouldn't have?

Share your silly mistakes and maybe we'll all feel a bit better about it.

Top comments (117)

Collapse
Β 
ben profile image
Ben Halpern β€’

Why aren't my changes having any affect?

Restart the servers β€” Nothing.
Clear development cache β€” Nothing.
Scour docs for hard restart options β€” Nothing
Print a bunch of <h1>Test test test</h1> all over the page β€” Nothing.

Oooooohhhhhh I'm looking at the production app.

Collapse
Β 
philnash profile image
Phil Nash β€’

I've done this so many times, for each combination possible out of dev, staging and production.

So. Many. Times.

Collapse
Β 
benjimouse profile image
Ben Best β€’

Better than the version of this I did a long time ago (back when all this was the wild west). I was updating live, not the test site I was looking at.
There's all sorts of things stopping me doing that now.

Collapse
Β 
philnash profile image
Phil Nash β€’

😱

Collapse
Β 
nataliedeweerd profile image
𝐍𝐚𝐭𝐚π₯𝐒𝐞 𝐝𝐞 π–πžπžπ«π β€’ β€’ Edited

Yes! This! More often than I'd care to admit. Have considered popping in a big red "DEV" block somewhere on the site to make it super obvious.

Collapse
Β 
philnash profile image
Phil Nash β€’

This is actually an excellent idea and I'm pretty sure there are dev teams out there that do this. The more obvious the better!

Thread Thread
Β 
nareshravlani profile image
nareshravlani β€’

I am one of them :)
I use big red button with text β€œtest” in navigation bar.

Collapse
Β 
igorrocha profile image
Igor Rocha β€’

I've done the same several times, except the screen I was looking wasn't even an app - it was an Invision prototype.

Collapse
Β 
allanjeremy profile image
Allan N Jeremy β€’

I've done this way too many times as well.

Or if you have multiple cloud projects and you've configured a project other than the one you are working on. So you push changes. Do a bunch of console.log() and still nothing

Only to realize you were deploying to the wrong cloud project!

Collapse
Β 
xybolx profile image
Mat Hayward β€’

Just learning some Test Driven Dev at work. Spent half the AM trying to get this phpunit test to throw an exception when no user id is present on persist. I was expecting the exception BEFORE running anything else in the test function so it was stopping before even testing anything. My boss came over to point that out for me and also pointed out I had no connection to the DB either. It's ok I'm a professional kids.

Collapse
Β 
mdgeus profile image
MD Geus β€’

Yep, been there, done that :)

Collapse
Β 
rachelsoderberg profile image
Rachel Soderberg β€’

I did something like that once... except I was looking at test and had OVERWRITTEN the production app. Good thing we have backups. Heh heh.

Collapse
Β 
darkmyj profile image
DarkMYJ β€’

I can relate

Collapse
Β 
yechielk profile image
Yechiel Kalmenson β€’

When I was doing Ruby I always misspelled initialize!

Collapse
Β 
philnash profile image
Phil Nash β€’

How did you spell it? As a Brit I am, of course, offended by the "z" and think it should be initialise anyway.

Collapse
Β 
yechielk profile image
Yechiel Kalmenson β€’

Lol, it wasn't a consistent misspelling, it's just a long word I kept fat-fingering.

What was most frustrating was that I wouldn't get a consistent "no method 'intialize'" error, it's just that I wasn't getting expected behavior and it would take me forever to realize it's because my initialize method wasn't being called!

Thread Thread
Β 
philnash profile image
Phil Nash β€’

Ah, the nightmare of a misspelled constructor. It's there, it's just pretending it's a regular method. Cheeky. And hard to track down. 😑

What are you writing things in most at the moment? And is it saving you from constructor woes?

Thread Thread
Β 
yechielk profile image
Yechiel Kalmenson β€’

These days I work mostly in Go, but even in languages with constructors I struggled with them enough that I now recognize a misspelled one sooner.

Thread Thread
Β 
ben profile image
Ben Halpern β€’

Programming has helped me discover that I truly never learned "I before E except after C". I'm always misspelling the BadgeAchievement model in the dev.to codebase.

As a Canadian I occasionally have hangups with keywords like color. Phil, you probably feel this too.

Thread Thread
Β 
philnash profile image
Phil Nash β€’

That's why we have postcss-spiffing.

body {
  background-colour: grey !please;
}
Thread Thread
Β 
philnash profile image
Phil Nash β€’

Top Tip!

Rename the BadgeAchievement model to BadgeAcheivement and never have this problem again!

Thread Thread
Β 
ben profile image
Ben Halpern β€’

I'm sure there are things like this in the code already 😭

Thread Thread
Β 
philnash profile image
Phil Nash β€’

πŸ˜…πŸ˜…πŸ˜…

Thread Thread
Β 
yechielk profile image
Yechiel Kalmenson β€’

Unrelated, but my last job had a referrals-based business model, so you can imagine the referrals table in their database was the most important table with indexes on almost every other table in the database.

It was spelled referalls, and every table apparently has its own convention of whether to name their column referall_id or referral_id πŸ€¦β€β™‚οΈ

Thread Thread
Β 
halldjack profile image
Jack Hall β€’

I once fixed a misspelling in a codebase without realizing that the name was coming from an external API's response so my correction broke everything. Misspellings that you can't fix are very frustrating.

Thread Thread
Β 
philnash profile image
Phil Nash β€’

@yechielk At least that's just in one app and not the Referer header supported in every web browser and server in the world.

Come to think of it, I bet the Referer header has caused multiple spelling confusions leading to things like this.

Thread Thread
Β 
philnash profile image
Phil Nash β€’

@halldjack Oh no! You must have thought you were fixing a bug instead of causing it. That's the worst!

Thread Thread
Β 
yechielk profile image
Yechiel Kalmenson β€’

Yes! Someone pointed out the referer header to me once, and I instantly felt better for the poor developer who created that referalls table...

Collapse
Β 
annarankin profile image
Anna Rankin β€’

Same! Also I type reutrn way more often then I type return. Every. Time.

Collapse
Β 
clmcgrath profile image
Chris McGrath β€’ β€’ Edited

for me it's retrun lol
i also embarrassingly wrote pubic instead of public during a tech talk

Thread Thread
Β 
dansilcox profile image
Dan Silcox β€’

I’ve done similar typos with β€˜countryCode’ πŸ˜‚πŸ™ˆ

Collapse
Β 
murjam profile image
Mikk Mangus β€’

Looking for an error for way too long many times and finally realizing there's a "form" instead of "from" or vice versa.

Collapse
Β 
yashints profile image
Yaser Adel Mehraban β€’

Love this, my worst nightmare was something like this πŸ‘‡

<script type="text/javscript" src="main.js"></script>

I spend hours trying to see why it's not working. Obviously it was a long time ago and I had no idea you could look into network calls inside browser πŸ€·β€β™‚οΈ

Collapse
Β 
philnash profile image
Phil Nash β€’

That's one issue with browsers not complaining if they can't do something.

"Sure," it thought, "this is a classing javscript file, shame I don't know how to parse and run them, on with the next element!"

So useful at times, so painful when it's a typo!

Collapse
Β 
yashints profile image
Yaser Adel Mehraban β€’

Couldn't agree more

Collapse
Β 
metalmikester profile image
Michel Renaud β€’

Javscript if the dialect of JavaScript used before your coffee kicks in.

Collapse
Β 
borisimple profile image
Boris Krstić ‒

So you wrote that function, but it doesn't work and you have no idea why.

But did you MAKE a CALL to that function SOMEWHERE in your code or it just sits there alone and lonely? :))

Seriously, when I focus so much on functionality, sometimes I forget to call that newly created function. That's why I started calling the function first, and then start writing the function itself.

Collapse
Β 
nandoblanco profile image
Nando β€’

omg this happened to me the other day... but I usually call the function first so it didn't dawn on me to check for the function till after a couple of hours just to make sure and BOOM, no function... I added the function, confirmed it worked and closed my editor. Didn't code for the rest of the day.

Collapse
Β 
philnash profile image
Phil Nash β€’

Or even write a test for the function first πŸ˜‰

Collapse
Β 
davshoward profile image
Davs Howard β€’

I spent literal HOURS about a decade back trying to debug a program only to realise I had written a 'j' instead of an 'i' on a for loop but I couldn't tell as the font for both was so similar.

I've not used 'j' as a variable since then ;-)

Collapse
Β 
ludamillion profile image
Luke Inglis β€’

I always used to go in the opposite direction for this reason. Need something after i? Go for h.

Collapse
Β 
davshoward profile image
Davs Howard β€’

I just avoid 'i' entirely now. Go for something like x, y, z if required ;-)

Thread Thread
Β 
philnash profile image
Phil Nash β€’

No more single letter variable names! What is this, degree level mathematics?

Wait, are you all Haskell programmers?

Thread Thread
Β 
davshoward profile image
Davs Howard β€’

If it's used as a counter in a for loop I don't see an issue with it.

Thread Thread
Β 
ludamillion profile image
Luke Inglis β€’

Personally I learned to program with C (and LISP) and sometimes my Javascript still sinks back towards into the C.

Collapse
Β 
siddude2016 profile image
Siddharth β€’

if my code doesn't run I restart the laptop.

Collapse
Β 
lukegarrigan profile image
Luke Garrigan β€’

haha, I like this.

Collapse
Β 
undeveloper profile image
unDeveloper β€’

On prod env:

  • drop table <important_table_here>;
  • update <table> set <sequential_field> = <constant_val>

:( now i check ten times before run a command :(

Collapse
Β 
akashdeepsingh profile image
Akashdeep Singh β€’

Oh yeah, this happened to me once. Ran an update without a where clause, and in the moments after that, I had planned my exile to a remote village in Scotland.
Fortunately, I had run select before the update, and it was a small table so al the data was on the terminal.

SET AUTOCOMMIT=0; after that.

Collapse
Β 
philnash profile image
Phil Nash β€’

Sounds like a good time to test your DB backups too!

Collapse
Β 
samuraiseoul profile image
Sophie The Lionhart β€’

extends when I mean implements as well as using / instead of \ or not including enough extra slashes to escape them. :(

Collapse
Β 
lewismenelaws profile image
Lewis Menelaws β€’

Whenever I did jQuery code, I wouldn't understand why my code didn't execute. turns out I would forget the period in the selector... $('dropdown').show()

Collapse
Β 
philnash profile image
Phil Nash β€’

I have the opposite! Now I have to kick myself every time I write document.getElementByID('#some-id'). πŸ˜…

Collapse
Β 
jonathanburnhill profile image
Jonathan Burnhill β€’

I'm forever missing out the dot for a class so made a snippet that does it for me

Collapse
Β 
rubiin profile image
Rubin β€’ β€’ Edited

Most of the time what I do is change something on the local api and query the hosted api for the changes via postman. Will go like this for about 5 minutes restarting and console logging the code until my sight gets the glimpse of the url in postman . Silly me

Collapse
Β 
philnash profile image
Phil Nash β€’

Ouch. And you can't even place a visual banner to say it's dev/staging when it's an API request.