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 (119)

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
 
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
 
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
 
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
 
phlash profile image
Phil Ashby

Colour coding works for me with UIs.. not quite so easy with APIs!

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
 
mdgeus profile image
MD Geus

Yep, been there, done that :)

Collapse
 
felixdorn profile image
Félix Dorn

true haha. I've done this so many times

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
 
codepanja profile image
Atul Kumar PK

Many times i update code in build folder's source file and the changes are not reflected. After several try i recognised that i'm a idiot.

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...

Thread Thread
 
candidateplanet profile image
lusen / they / them 🏳️‍🌈🥑

are we sure they didn’t mean “refer all”s intentionally? you know, all of the refered people. or referred?

never give in

Thread Thread
 
yechielk profile image
Yechiel Kalmenson

Lol, yes, we're sure 😂

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
 
philnash profile image
Phil Nash

Or even write a test for the function first 😉

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
 
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
 
phlash profile image
Phil Ashby

Good ol' K&R has a lot to answer for..

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
 
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
 
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
 
phlash profile image
Phil Ashby

using/import extends/implements/: ... too many languages in the same head :)

Collapse
 
mateiadrielrafael profile image
Matei Adriel

The thing is typescript has both extends and implements so it makes it even worse

Collapse
 
philnash profile image
Phil Nash

That's a favourite of mine too. A great way to write a correct action in Rails and then watch it fail to work in tests and routes.

I could almost see the Rails team agreeing to alias common misspellings like this to avoid the heartache!