DEV Community

Cover image for Are You Ashamed of Your Old Code?
Anita Olsen*°•.¸☆
Anita Olsen*°•.¸☆

Posted on

Are You Ashamed of Your Old Code?

The code below is one of my earliest Python codes and I find it terribly cute :3

My code input:
print("WELCOME TO PYPET")

bunny = {
"name" : "Muffy",
"hungry": False,
"weight": 5.4,
"age": 4,
"photo": "(-'.'-)",
}

bird = {
"name": "Bell",
"hungry": True,
"weight": 0.7,
"age": 2,
"photo": "(v)",
}

print("Hello " + bunny["name"] + "!")
print(bunny["photo"])

print("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")

print("Hello " + bird["name"] + "!")
print(bird["photo"])

def feed(pet):
if pet["hungry"] == True:
pet["hungry"] = False;
pet["weight"] = pet["weight"] + 1
else:
print("The Pypet is not hungry.")

pets = [bunny, bird]

print("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")

for pet in pets:
feed(pet)
print(pet)

print("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")

print("It seems all is well here!")

print(bunny["photo"] + "<3 " + bird["photo"] + "<3 ")

My code output:
WELCOME TO PYPET
Hello Muffy!
(-'.'-)


Hello Bell!
(v)


The Pypet is not hungry.
{'name': 'Muffy', 'hungry': False, 'weight': 5.4, 'age': 4, 'photo': "(-'.'-)"}
{'name': 'Bell', 'hungry': False, 'weight': 1.7, 'age': 2, 'photo': '(v)'}


It seems all is well here!
(-'.'-)<3 (v)<3

A screenshot of my code input and output:

My python code for a Pypet with Py short for Python

Run my Pypet program on Sololearn: https://www.sololearn.com/compiler-playground/cc7aEOtvMmUi

I do not feel the least bad about my old code. It is what it is. It was a start, my start and we all have to start somewhere!

Are you ashamed of your old code?

Top comments (42)

Collapse
 
kaamkiya profile image
Kaamkiya

Not that much. After all, my old code is from when I had less experience. I sometimes rewrite my old projects, to help me learn more. Then I get more experience, and the cycle repeats. I'm sure I'm not the only person like that.

Collapse
 
ddaniel27 profile image
ddaniel27

This is exactly what happens to me. =

Collapse
 
m0n0x41d profile image
Ivan Zakutnii

As my mentor said just yesterday:

"If you don't feel ashamed when you look at your code from two months ago, it means you are not progressing in programming."

No offense, he is a tough one. And this was said in the context of an internal chat for devs with, at least, a few years of experience.

Collapse
 
fnh profile image
Fabian Holzer

I want to assume good faith and file that under an invocation of the olympic motto "faster, higher, stronger". Yet, I am not sure if such a view point doesn't degrade into some kind of programmer machismo that in the end impedes growth in adjacent areas, that are of equal (if not higher) importance the more senior you get. Investing in programming alone yields diminishing returns.

Collapse
 
m0n0x41d profile image
Ivan Zakutnii

I cannot agree or disagree with you here because I don't understand what you mean by programming. But it seems, that you are meaning "programming in small".
Certainly, I wasn't verbose enough about my mentor and our cool underground OOA/D cult.

Collapse
 
teamradhq profile image
teamradhq

I feel like this is a really bad take from an insecure person.

Why would you feel shame over your past contributions? Does your code not work? At least this would make sense to me, because if your implementation falls down after two months, then perhaps you were doing it wrong in the first place.

I mean, I did a lot of stupid s*t when I was younger, because I didn't know any better. If I was still doing the same stupid s*t now, I'd probably feel ashamed and it would be valid to say that I have not progressed as a human.

But come on! Why do you need to be ashamed of your past work in order to progress in your programming?

I don't feel ashamed of my eight year old because he can only count to 10 in binary: I feel proud, because he's able to count to 10 in base2! That's amazing for someone with little to no experience.

You should feel proud of your work and be kind to yourself. You delivered something that work(s/ed). It's the reason you're here today, and not quitting for another profession because some brogrammer flexed their muscles to make you feel inferior.

Hopefully your dev team are secure enough to ignore this kind of brain-rot being passed of as sage advice.

Collapse
 
m0n0x41d profile image
Ivan Zakutnii • Edited

In our underground, Spartan-like software architects' school, we don't do wimps or whiners.

Everyone picks their own comfort zone, pace and their view from the window.

This is ours ¯_(ツ)_/¯

You should feel proud of your work and be kind to yourself.

Come on, if you're able to spot a major flaw in your programming or architectural decisions from just two months ago, and if you're brave enough to not only feel ashamed but also to rush in and fix it, that's a real reason to be proud of yourself :)

It is always easy to bring pawns up and "let it work for the time being, this is working innit"? naah))))

But of course, this is us, and unfortunately (or fortunately?), this approach and mindset doesn't work for most people. Everyone deserves to live their lives filled with happiness and joy. Keep spreading the love, my friend <3

Thread Thread
 
teamradhq profile image
teamradhq • Edited

Taking pride in being ashamed... how quaint.

What happens when you discover defects introduced by other team members? Does everyone in your team dogpile on them? In my experience these kinds of attitudes in teams don't produce wins: quite the opposite.

Also, does everyone in your team go to crush weights in the gym together, and do you go before or after throwing the wimps off the cliff? I'm dying to know so I can incorporate this into my routine :P

Spartans are famed for their military prowess, individuals putting aside their little egos and working together as a single unit - although mostly applied to enslaving the helots to do all of their work for them. The modern day software equivalent would be outsourcing your work to India and then showboating around while you take credit for the work.

Come on, if you're able to spot a major flaw in your programming or architectural decisions from just two months ago, and if you're brave enough to not only feel ashamed but also to rush in and fix it, that's a real reason to be proud of yourself :)
It is always easy to bring pawns up and "let it work for the time being, this is working innit"? naah))))

It's a false equivalency to say that people who don't feel ashamed of defects in their software won't fix said defect. You don't need to be ashamed of yourself to roll up your sleeves and fix a problem, and not feeling ashamed of your past choices doesn't mean that you'll say, "Nah mate, she'll be right." In my experience it's usually the people who are ashamed of their mistakes who try and cover them up, not the other way around.

More to the point, the assumption that your code is "shit" is the only reason for defects to appear in your system is not a good starting point for resolving issues. Yes, I think it's healthy to assume that you are at fault and work on eliminating yourself as the cause first. But that's literally so you can avoid the blame game - not buy into it like your mentor seems to suggest.

Text book example would be a regression, which could have happened through no fault of your code, and possibly been introduced by someone else. So back to my first question, do you reach for the dunce's hat and pile on that person, or do you kindly explain what's happened and work with your team to resolve the issue?

Here's a thought: try skipping the pride and the shame and go straight for humility.

Anyway, point is that your decisions two months ago produced a working implementation and passed whatever checks and multiple stakeholder approvals to get shipped in the first place (this is a team sport).

And some friendly advice from a greybeard who has spent countless hours mentoring impressionable young lads such as yourself: get a mentor who is not shit and is secure in the fact that they have no clue. <3

Collapse
 
ldrscke profile image
Christian Ledermann • Edited

It is a tale of two kitchens code does not age gracefully, even if it started out clean, it accrues technical debt over time. The decisions you made originally probably seemed like a good idea at the time.

We have all been there:
What does this do 🤔️ ?
What 😕️?
WTF 🙄️?
WTAF 🤬️⁉️
This is so wrong on so many levels 😡️ !
How did this even work 🤯️?
Who wrote this 💩️ ?

Image description

Ooooooops 😊️🤫️🤐️😇️

Collapse
 
moopet profile image
Ben Sinclair • Edited

You can format your code by putting it inside backticks - here's a
Markdown cheatsheet about embedding code. It's particularly important for Python since whitespace is significant to the language and without using proper formatting, your program looks like it's all left-aligned :)

Collapse
 
phlash profile image
Phil Ashby

Much respect for the PyPET(s) 😁

My oldest work is not online (it's printed on fanfold, in the back of my masters degree project report from 1989), but the stuff I did a couple of years into the 90s was on 1/4" backup tapes, so a few years ago I did the decent thing and published here:
dev.to/phlash/everyone-should-writ...

I'm not ashamed of this work, it's where I was after 4ish years of professional development, and this was a fun side project, which taught me a lot about structuring both production code and tests to stay sane.. although the less said about the compiler warnings the better!

Collapse
 
anitaolsen profile image
Anita Olsen*°•.¸☆

Thank you so much! 😊

Woah, awesome! Oh, and writing my own operating system has truly been on my mind! You seem to be quite the hustler, you are AWESOME! ✨

Collapse
 
ben profile image
Ben Halpern

I used to be — now I'm self-assured enough to be proud of my progress without much regard for shame for the old thing.

Collapse
 
ozzyogkush profile image
Derek Rosenzweig

There's only one project that I can say I'm ashamed I wrote. It was a Computer Graphics class, and we had to implement simple low level graphics algorithms (drawing lines, polygons, clipping, etc) in a series of assignments. I chose to do it in the language I knew best at the time, Perl. It was definitely not my best work.

Besides that, no because I always tried my best, it did the job (and hence I got paid, when it was for work), and even mistakes are learning opportunities.

Collapse
 
phlash profile image
Phil Ashby

Part of me really wants to see that 2D graphics in Perl 😁, I did something similar very recently in Java: Graphics.java
Performant it ain't, but it works (tm).

As for old code... mine is on fanfold printout from 1988(!), and I'm certainly not ashamed of it, although it's well past it's useful period, even if the language is still alive and well (thanks C!)

Collapse
 
peterwitham profile image
Peter Witham

Not at all. When I or someone else looks at my old code, I hope they say, "You have come a long way."

Which is also an excellent way of saying I have learned and expanded my understanding of the problem I was solving.

This is also something I learned to get over real fast when I started live streaming development thanks to all the back seat coders :)

Collapse
 
anitaolsen profile image
Anita Olsen*°•.¸☆

This is an excellent way of looking at your old code! I like to see my code this way as well :)

Collapse
 
vivek09thakur profile image
Vivek Thakur

No I am not, It reminds me how far I came and I smile a little bit whenever I see my old works. Also my old projects are my fav I keep working on them whenever I got time and try to improve them as much as possible. And yeah its good.

Collapse
 
prsaya profile image
Prasad Saya

That is why someone invented Refactoring. The "old code" is your creation. It is to be approached, improved, refactored and then feel good about it. When you are done you know that you are a better programmer!

Collapse
 
teamradhq profile image
teamradhq

In a word, no.

I do feel some negative emotions when previously working implementation stops working, even though it's remained unchanged for [insert age of last commit here]... But never shame.

If there is any emotion, thought or action that my previous work inspires in me, it's the same when one I experience when working with less knowledgeable or experienced developers: kindness.

Collapse
 
jakeespinosa profile image
Jake Espinosa

No, and no one should feel ashamed. What you wrote in the past is a reflection of what you knew at that time, and feeling like it is bad code is just a sign that you have improved. No need to feel ashamed.

Collapse
 
montyharper profile image
Monty Harper

It isn't necessary to feel shame in order to look back and understand that you would do things differently today, knowing that your that your knowledge and experience have grown since then. Maybe better to think of it as feeling proud about how far you've progressed.

Collapse
 
dekmabot profile image
Dekmabot

Sure no, that is what I was studying with) I had a period in time, when I hided my projects from others, but later I started to view some other person`s projects and saw that everyone make silly mistakes and use inappropriate methods.

Collapse
 
anitaolsen profile image
Anita Olsen*°•.¸☆

Exactly! Well said!

Collapse
 
crvanetten15 profile image
Connor Van Etten

I miss my old code tbh. Lack of knowledge made me more creative in finding solutions with rudimentary tools. Building Command Line games built 100% off of 600 line if else trees was such an interesting time. Though nothing I wrote in my first year of code was considered "good" I was so proud of it. So no, I was proud then and I still am today.