loading...

Those silly mistakes we all make

philnash profile image Phil Nash ・1 min read

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.

Discussion

pic
Editor guide
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 Author

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
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
𝐍𝐚𝐭𝐚𝐥𝐢𝐞 𝐝𝐞 𝐖𝐞𝐞𝐫𝐝

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 Author

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

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

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
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
pkatul 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 Author

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 Author

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 Author

That's why we have postcss-spiffing.

body {
  background-colour: grey !please;
}
Thread Thread
philnash profile image
Phil Nash Author

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 Author

😅😅😅

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 Author

@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 Author

@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

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 Author

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 Author

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
phlash909 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 Author

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

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

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
samuraiseoul profile image
Scott Lavigne

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

Collapse
phlash909 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
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 Author

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
akashdeepsingh profile image
Akashdeep Singh

I sometimes mix up the href and src in the link tag in html.
<link rel="stylesheet" type="text/css" src="theme.css">
instead of
<link rel="stylesheet" type="text/css" href="theme.css">
and it has taken me and colleagues several refreshes to figure out in the past.

"The css file is there. Why isn't it loading? Did you clear the cache? Did you restart the laptop? Did you check the URL?..."

Collapse
philnash profile image
Phil Nash Author

I feel that pain. HTML is both forgiving ("the page still loaded") and brutal ("but it didn't work and I don't know why") at the same time.

Collapse
darkmyj profile image
DarkMYJ

I just learn css/html few weeks ago, and this is hurt when it happens

Collapse
oseifrimpong profile image
Obed Osei Frimpong

I left out a backlash in an endpoint. I had to ask for help from another Senior Dev. He then pointed out that to me. I looked very stupid but I guess it's all part of the work.

Collapse
ludamillion profile image
Luke Inglis

I looked very stupid but I guess it's all part of the work.

I find that the longer I work in the dev field the more my questions for other devs move towards the edges. Either they are complex architecture-y questions or I'm doing something mind-numbingly dumb and can't see it myself.

Collapse
philnash profile image
Phil Nash Author

I think my point behind all of this is that we all make these mistakes. Likely every day. Most of the time we catch it ourselves. Some of the time the fix is pointed out by someone looking at it with fresh eyes. Once in a while we ship it to production.

If we can all agree that we're not looking stupid or dumb when this stuff happens, then we'll be more likely to ask for help, more likely to catch issues, less likely to spend minutes/hours/days on something and more likely to ship a quality product.

Collapse
nataliedeweerd profile image
𝐍𝐚𝐭𝐚𝐥𝐢𝐞 𝐝𝐞 𝐖𝐞𝐞𝐫𝐝

Sometimes you just need a second pair of eyes. If you spend so long looking at your code, you won't be able to see the forest for the trees :) I never judge a developer if the solution is simple, because I know I have been and will be in the same situation soon!

Collapse
philnash profile image
Phil Nash Author

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!

Collapse
rubiin profile image
Rubin

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 Author

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

Collapse
phlash909 profile image
Phil Ashby

Late reply - but a thought occurred to me - what about a response header 'X-Environment: test/dev/prod', that might help when staring at Postman for the umpteenth time?

Thread Thread
philnash profile image
Phil Nash Author

Might help! Though I know I would likely be looking at the body of the response rather than the headers. Sometimes there’s just no guard against ourselves 😄

Thread Thread
phlash909 profile image
Thread Thread
philnash profile image
Phil Nash Author

That's a good idea though. Maybe it will get enough support.

Collapse
denmch profile image
Den McHenry

I’d never worked with Visual Studio before and for a long time I’d forget to commit changes to the project file, so that everything worked locally but when my colleague pushed changes, there was no reference to new files and the site would compile without them.

Collapse
philnash profile image
Phil Nash Author

A classic "works on my machine" 😄

Forget committing changes. Backup the rest of your work and send your laptop up to prod!

Collapse
denmch profile image
Den McHenry

The bit that hung me up was that the files themselves WERE committed and present, and the other developer could see them, but since they weren't referenced in the .csproj file, they didn't make it production. I don't know how many times I did that in the early going.

Thread Thread
philnash profile image
Phil Nash Author

Oh that's so weird. I've not worked with C# or Visual Studio and this would definitely catch me out.

Collapse
phlash909 profile image
Phil Ashby

I think I prefer destory.. we're done now folks, time for bed.

Collapse
philnash profile image
Phil Nash Author

I like this interpretation too!

Collapse
jafaircl_66 profile image
jafaircl

For the life of me I couldn’t figure out why my Angular Material component wasn’t emitting events the other day. After about an hour of pulling my hair out, I realized I had written (seletionChange) instead of (selectionChange) in the template

Collapse
philnash profile image
Phil Nash Author

Are you saying you couldn't c the issue? 😂

Collapse
programazing profile image
Christopher C. Johnson

I couldn't understand why a new feature wasn't working after I added some fields to a table. It was driving me nuts!

Turns out I forgot I was connected to the tester's DB instead of dev.

Collapse
philnash profile image
Phil Nash Author

Meanwhile the tester has no idea why their DB is sprouting fields.

I love this one, it's not one I've done (no-one else lets me connect to their DB 😁) but I can still feel the intense frustration knowing you added the fields but finding them nowhere in your dev app.

There can never be too many banners telling you what environment you are currently working with.

Collapse
laurieontech profile image
Laurie
Collapse
flrnd profile image
Florian Rand

I tend to misspell porps instead of props in react 🤓

Collapse
philnash profile image
Phil Nash Author

Porps! Super porps!

A trio of porpoises

Collapse
metalmikester profile image
Michel Renaud

I spent all day yesterday on a problem only to realize that it was an array index off by one (some code was in JavaScript, some in C#/Razor, and I didn't notice the C# part was generating the wrong numbers in the HTML). Of course, the code was trying to resolve something in the wrong set of data, leading to very weird results.

Expletives were used.

Collapse
yujiri8 profile image
Ryan Westlund

I was working with JS template strings and wrote {...} inside them, and wondered why the variable wasn't appearing properly. I spent about an hour checking every other place I'd changed again and again until my boss pointed it out to me.

Collapse
denmch profile image
Den McHenry

I also have a tendency to type isntall instead of install and then imagine “isn’t all” as a command to delete everything (“make isn’t all that is!”) because my brain is weird.

Collapse
philnash profile image
Phil Nash Author

That misspelling is so common that npm aliases isntall to install so you never have to notice you got it wrong! 😅

In fact, I just checked and they have a whole bunch of "affordances" for us fat fingered typists! verison might be my favourite.

Collapse
denmch profile image
Den McHenry

Verison is my new vegan deer meat alternative.

Collapse
maureento8888 profile image
Maureen To

I was coding with HTML the other day, and I usually correct my code (copy and paste a piece elsewhere) as I go along to clean up the interface, but then I forget to add the closing tags for the elements, making me spend HOURS trying to figure out why the hierarchy on my screen isn't working and why things weren't showing up 😂

Collapse
mercier_remi profile image
Rémi Mercier

I'll always add a new route to my Rails app and forget to restart the local server. After 10 minutes of wondering why the hell my code doesn't work anymore, I'll 🤦.

Collapse
philnash profile image
Phil Nash Author

The worst thing is when you know all the code is right and you just don't know why it's not running. And then...

Have you tried turning it off and on again

Collapse
totally_waqas profile image
Waqas

I made a new react component but kept getting type errors (was using typescript) in VS Code. I removed everything one by one until I was left with just a ‘< div />’ and still there were squiggly lines all over. I looked everywhere but couldn’t figure out why (even copied the entirety of a component that was working). Ultimately, I realised my file was a ‘.ts’ instead of ‘.tsx’.

Collapse
philnash profile image
Phil Nash Author

One "x" out of place and not even in the contents of the file. Ouch!

Collapse
marcellothearcane profile image
marcellothearcane

User: I can't save anything!
Me: What? Of course you can.
User: It won't save, it just says 'field not found' - what does that mean?
Me: Ohh...

I haven't unlocked permissions for the user role. It works for my admin role!

Collapse
phlash909 profile image
Phil Ashby

Probably my most annoying habit, that gets me far too often:

% vi whatever.c
% gcc whatever.c
% ./whatever
bash: ./whatever: No such file or directory
% {grumbling} mv a.out whatever
% vi Makefile

Too much haste, should always write the Makefile first!

Collapse
philnash profile image
Phil Nash Author

Hehe, I've trained myself to start every project, no matter what, with some sort of project generator script to make all the files I need. I've definitely spent my time grumbling over this sort of thing before though 😅

Collapse
carsturdy profile image
Carson Sturtevant

I can't tell you how many times I've done something like:

if(a = b) {
// do something
}

After some time I finally realize that i didn't put a second =.

Collapse
philnash profile image
Phil Nash Author

Oh, I've done this before. It's such a pain to spot a missing =!

Collapse
duc profile image
Aryan Godde

When you use bluej and you are a beginner. You make a program but it has no output such as system.out.println. And then you try to execute it and have no errors but blank output this happened to me on my examinations, good thing it was not too late for me i made it and got full marks gg

Collapse
deathshadow60 profile image
deathshadow60

I forgot to include a viewport META in the example code for an article about using CSS instead of JavaScript to make a mobile "hamburger" menu, then for a week couldn't figure out why people were reporting that the font size was uselessly tiny on their devices... wasted time throwing all sorts of style at the problem and staring at the CSS, when the problem was in the markup.

Collapse
dansilcox profile image
Dan Silcox

Could not get a Lambda .NET core project to run locally with AWS toolkit earlier, spent about 1/2 hour digging around and searching for some missing dependency - ended up asking another dev - turned out I just set the wrong start up project in VS 🤦‍♂️🤦‍♂️🤦‍♂️

Collapse
metalmikester profile image
Michel Renaud

Nearly 25 years ago. Programming in SAS on the mainframe for the first time. I had to process some data and output some summary reports. Of course, there was a need for some blank lines.

Now, printing on the mainframe: The printer was in another building. A few times a day, someone would bring the printouts over to a specific floor in the other two buildings. So, you had to wait until the time the printouts are dropped off and then go to the floor in the building where they are left and hope it had printed in time for this run.

Obviously, since I was new at this, I figured I'd develop the reports on screen until they looked good enough to see how they looked on paper. Makes sense, right?

The blank lines would never show. Everything was stuck together with no spacing. I tried dozens of things, to no avail. I mentioned it in passing to a couple of more experienced people but they just assumed I needed to work more at it, I guess.

I worked at this all week, no success. Come Friday, we have a section meeting and I mention the issue. Right away some guy with lots of mainframe experience says, "Oh, that's normal. The blank lines won't show on the screen. You have to print if you have to see them."

That look of annoyance on my face coupled with me laughing out loud must have been something.

Collapse
jonathanburnhill profile image
Jonathan Burnhill

Once spent 2 days wondering why my login component wasn't rendering.....
Was looking on the wrong page 😂😂😂😂

Luckily this was in my practice days and not anything serious.

Still not sure why I decided to pursue it as a career after that

Collapse
philnash profile image
Phil Nash Author

Because we all do it! 😂

Collapse
ali profile image
haider ali

One of those silly mistakes that a friend of mine always does in laravel is when he is editing a "blade" file and expect the result in another file .. so we often spend 15 min until we figure out that we are working on the wrong route or blade

Collapse
philnash profile image
Phil Nash Author

I had to check, blades are view templates in Laravel, right? It's a badass thing to say you're working on regardless! So many templates look the same though, it's easy to mix up.

Collapse
dannetherton profile image
Dan Netherton 👨‍💻

widows: 100%

'Nuff said.

Collapse
philnash profile image
Phil Nash Author

Dear VS Code,

I never mean widows. I always mean width. Always.

Regards,

Phil

philnash profile image
Phil Nash Author

A quick search on Google doesn't show anything, but I still wouldn't be surprised if there's something out there 😁

Thread Thread
moopet profile image
Ben Sinclair

chuckles in vim

innoremap destory destroy

Thread Thread
philnash profile image
Phil Nash Author

There's always a vim answer. What happens if you misspell innoremap though? 🤔😅

Thread Thread
moopet profile image
Collapse
jonasgroendahl profile image
Jonas Grøndahl

That moment when you are setting up a web server and you don't understand why it's not loading your index.html on both HTTP/HTTPS. Oh wait, firewall (AWS EC2 -.-")

Collapse
ferdelvalle profile image
Fernando Del Valle

Why isn't my function working?!

*forgot to call it

Collapse
pungiish profile image
Jan

pm2 reset app instead off pm2 restart app, and was wondering what impossible bug have i introduced into my code, because i couldn't fix it 🤦‍♂️