(The context here being: working with problematic legacy code and getting to the point where you have new code (paths) that do(es) the same thing but without the issues, so that the old code, and its issues, can just be discarded)
Also, deleting code you wrote earlier in the project because you've made a more general applicable implementation, hence the old code isn't used any longer.
I see some kind of VCS as a baseline project requirement, and in that case commenting out code is a very big anti-pattern.
And even without it, should an obsolete version of a codepath forever remain in your codebase, even long after it's become sufficiently inconsistent as to be irrelevant?
yes. I've been deleting a lot of unused code recently and it feels so good. except for that moment when you realize that the code you deleted is used in another module but this is not documented anywhere
I'm a big fan of both having a calm + non-interrupted refactoring session or discussing with colleagues about alternatives of how to implement something or just naming conventions to plan to use.
My name is Lewis Menelaws. I am a developer and entrepreneur located in Sarnia, Ontario focusing on creating great things for the web. Currently I am Lead Developer and Co-Founder of TMRRWinc.
The pleasure of finally being able to get it or to make something work. Having all those tabs open to just have them closed is some of the best feelings ever... Especially when it looks like this:
+1 for the last one. I've been working as a junior/front end dev on a freelance project with a C#/asp.net developer who has 12 years of experience. Reading his code and studying it until I understood how all the functions worked was a complete game changer!!
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
There are comments and comments. The comments explaining what the code does are usually a symptom that the code is convoluted and difficult to understand even for the person who is writing it.
On the other hand, there are comments like:
# This solves a bug in the library Fubar that prevented the Baz
# from being executed. See: https://github.com/fu_bar/baz/issues/454
Or:
# Temporalirly removed as per request in Issue #1243
Currently developing futuristic smart-device, IoT connected, highway construction site safety system in EU.
Used to work on infrastructure, application architecture and cloud engineering.
A lot of truth to this, but an exception can and should be made when something merits an explanation of why it is the way it is. Comments should be few and far between in well-written code, but still used when there's an actual need. For me that's usually just when I had to dig to find a way to make something work when a more intuitive solution wouldn't work in that specific case.
Indeed, some business concerns are just impossible to explain by code itself and as you've said, logic that by some black magic doesn't work.
The key is to know if comments are up-to-date with the code as refactors come and go and not everyone updates the comments.
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
While I agree with not using comments where the code can demonstrate its own purpose and mechanism, I don't like absolutes like "don't use comments". An RFC number or something can be very helpful, or a link to where you found the code you just copy-pasted.
I read Stephen King's book On Writing, he described the development of the story as carving something out of stone. You just start hammering the hell out of the block then it just starts resembling an image (something like that).
My reaction was "Haha, that's what I do when I write code"
Only when I read that book I realised that that might be the reason why I don't look forward to finishing projects - hammering away is fun.
Refactoring, getting rid of code, Visual Studio Code that sometimes does magical stuff, having tests passing and how easier things are now that I'm using a 24" inch monitor again instead of the Macbook's 13" :D
I absolutely love getting to build things from the ground up. Some of my favorite things I've done at my job were things I had to start from scratch. I enjoy most coding tasks, even fixing bugs, but my favorite by far is seeing a feature or product I helped make with no code to start out with.
My guilty pleasure is I enjoy fixing bugs. Each bug is like a mini-puzzle, and (usually) is apparent whether or not it is fixed or still broken.
Two large monitors. And I'm super particular about keyboards. (IBM Model M forever!)
Clean code makes me happy. I wish there were refactoring tools for C++, like I had JetBrains ReSharper for C#.
The one surprise I had was how much I enjoyed TDD using C#, NUnit, and the awesomely amazing test-runner NCrunch. I really miss that now that I'm back in C++.
If it's not a trivial bug you usually learn A LOT chasing a bug. Sometimes you end up with patches to third party libraries, sometimes you end up with more insight about the framework or the language or even parts of your own code you forgot about :D
My two favorite bugs was finding a bug in the compiler (can't remember which compiler anymore, too many years ago - I'm sure it was not GCC), and finding a bug in the gdb debugger.
Lining stuff up vertically. Whether it's the values in key->value literals, wrapped method parameters, class members, or anything else, everything is just so much nicer to look at when it's all lined up vertically.
Fixing up brittle, archaic tests so that they're fast and much easier to follow and iterate on.
In general just getting things to a more maintainable state for the future (probably due to joining teams where the codebase I have to grok is nearly impenetrable).
Coming back to old code after learning something new and applying it there. Feels great and makes me feel like I'm progressing, especially since I want to do this for a living and I only do it as a hobby at the moment.
Really basic but, autocomplete is the little thing that gets me going the most. That breeze you get when you press Tab and the function appears, is something magical.
Context: I've been coding for a little more than a year, being self taught, I discovered autocomplete like two months ago.
It's very useful! Since i have to change languages from time to time it's a challenge to memorize what it will autocomplete and if it will be the same that i want hehe
Currently developing futuristic smart-device, IoT connected, highway construction site safety system in EU.
Used to work on infrastructure, application architecture and cloud engineering.
I like testing with silly content, be it inside jokes as a message to see if a component has rendered, or injecting cat pictures as place holders.
My all-time favorite is adding in a marquee tag that scrolls by with "H E L P" in big letters when working with something that's been frustrating me. It never gets old, for some reason, and it helps me feel like I'm in less of a rut.
My guilty pleasure is replacing large external dependencies that were included just to avoid writing a few lines of code oneself with said few lines.
The last codegasm I had was when I replaced the whole of moment.js in an app where it was only used to format the users' time zones for tracking purposes with 4 short lines of script. Boom, 60kb less for the user to download.
Yes, I know there's NIH (not invented here), but sometimes I feel like that's just an excuse for being lazy and using overengineered solutions for simple problems.
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
Finding someone else has the same, unanswered problem on Stack Overflow and remembering once you've solved it to go back and explain what you did with examples. Doesn't happen to me often enough, but it's a good feeling.
I just love when I learn some trick or new feature or concept in some basic tutorials or article, and then one day working, I run into situation and realize that I can actually use it in my project (or it even solve some big issue) :)
Finding a library like Polly. It provides a variety of resilience strategies in a composable way. Think of retry, fallback, circuit breaker etc. The documentation is excellent.
It made me happy because it allowed me to deliver a much better quality solution than I could have rolling my own, especially 'within scope' for the task at hand.
👨🏫 Co-Founder of This is Learning, Organizer of AarhusJS
✍️ Writer, Speaker, FOSS Maintainer 📗 Author
🏆 Microsoft MVP 🌟 GitHub Star
🌊 Nx Champion 🦸 Angular Hero of Education
1) Automated testing and linting in a neat DevOps pipeline 🤤🤤🤤
2) I have not looked back since I started using the Microsoft Sculpt Ergonomic Desktop kit 3½ years ago.
3) 2 pivoting monitors with one in portrait mode. Each at least 27" and 2560x1440.
Feeling all smart and professional. Much of my life had me feeling looked down on by people older than me. Being in control of complex code and in the flow of all the knowledge and information makes me feel like someone worth taking seriously :)
Started learning to program seriously early 2017, cofounded a web company, did that for a bit and then life changed and we closed that down and I moved into Sr. Ops Mgmt and Project Mgmt.
Having a strange idea popping in my mind, immediately starting to code something and having some very basic structure that does the job, a few hours after.
Refactoring tests so that editing or adding tests are not a pain then in the ass anymore. Using stuff like Page object pattern when I need to refactor UI tests.
When another dev discovers your refactoring or implementation and thanks you for making their life easier. That's the best way of making me happy, I think.
Getting an error. It makes me happy that I have this opportunity to learn about what I did wrong and improve. And then when I’ve fought through them all, it feels so good when it works.
I am a self taught developer that works best when floating in between design and engineering teams. I enjoy sharing what I know via short instructional screencasts and the occasional written post.
Pellentesque nec neque ex. Aliquam at quam vitae lacus convallis pulvinar. Mauris vitae ullamcorper lacus. Cras nisi dui, faucibus non dolor quis, volutpat euismod massa. Donec et pulvinar erat.
Quiet and silent environment.
I work in an offshore service industry kind of setup and I hate it when people put their overseas call on speaker eventhough only one person is attending.
Getting my team to use new tools I built to make them more efficient. Be that classes that help accomplish some repetitive thing, better CLI tools, some sort of CI automation, or whatever.
Born and raised in Montana. I love drawing and technology. I lost my job in home construction due to the economic downturn. It was then that I realized I loved to code.
I love when someone hands me a paper document to fill out or for information. Every time I see this as an opportunity to show them how it could be done with web or mobile.
Finding a bug after hours of looking up for it.
Finding a big after a really short time of looking for it.
Guessing by a first attempt what a code (not mine) does.
Deleting code.
(The context here being: working with problematic legacy code and getting to the point where you have new code (paths) that do(es) the same thing but without the issues, so that the old code, and its issues, can just be discarded)
Yes!
Agreed!
Also, deleting code you wrote earlier in the project because you've made a more general applicable implementation, hence the old code isn't used any longer.
Yeah I saw that as included in the previous, since I don't see 'legacy code' as inherently being 'code written by somebody else' :-).
When we come up with this kind of comments:
I would suggest just comment out codes rather than delete (or have versioning in place).
I see some kind of VCS as a baseline project requirement, and in that case commenting out code is a very big anti-pattern.
And even without it, should an obsolete version of a codepath forever remain in your codebase, even long after it's become sufficiently inconsistent as to be irrelevant?
Or deleting old code that just exists, is no longer used!
yes. I've been deleting a lot of unused code recently and it feels so good. except for that moment when you realize that the code you deleted is used in another module but this is not documented anywhere
ikr
oh so true...
Yep... This too XD
If I have momentum on something and I'm locked in with my ideal monitor setup I feel like Batman at his dashboard. So much power at my fingertips.
When things aren't going so smoothly:
I'm a big fan of both having a calm + non-interrupted refactoring session or discussing with colleagues about alternatives of how to implement something or just naming conventions to plan to use.
The pleasure of finally being able to get it or to make something work. Having all those tabs open to just have them closed is some of the best feelings ever... Especially when it looks like this:
True story. Pleasure of clicking on "close tabs to the right" 😁
The good-old picket fence!
+1 for the last one. I've been working as a junior/front end dev on a freelance project with a C#/asp.net developer who has 12 years of experience. Reading his code and studying it until I understood how all the functions worked was a complete game changer!!
It doesn't happen often because there's usually a catch when it does, but when code works the first time, I get really giddy :D
I usually feel extra nervous...
Yes, if all the tests pass immediately, that's a moment to step back and think reaaaaalllll hard.
True. The feeling when you write code and the computer does what you intended.
I really like writing code comments, although I don't do it too often. I'm still learning how to make them meaningful first.
I was taught that you should not use comments. To avoid comments your code should be written in a way that can be read like a comment.
I wrote a little article showing the difference of code that needs comments and other that it doesn't.
There are comments and comments. The comments explaining what the code does are usually a symptom that the code is convoluted and difficult to understand even for the person who is writing it.
On the other hand, there are comments like:
Or:
Those make perfect sense to me.
Works very well in commit messages when you have Bitbucket integrated with Jira. Hell of a difference!
A lot of truth to this, but an exception can and should be made when something merits an explanation of why it is the way it is. Comments should be few and far between in well-written code, but still used when there's an actual need. For me that's usually just when I had to dig to find a way to make something work when a more intuitive solution wouldn't work in that specific case.
Indeed, some business concerns are just impossible to explain by code itself and as you've said, logic that by some black magic doesn't work.
The key is to know if comments are up-to-date with the code as refactors come and go and not everyone updates the comments.
With this I fully agree, that's something I've been trying to improve on myself.
While I agree with not using comments where the code can demonstrate its own purpose and mechanism, I don't like absolutes like "don't use comments". An RFC number or something can be very helpful, or a link to where you found the code you just copy-pasted.
So am i.While i agree with Jose Tomas that try to make your code self-interpretation as possible.I'm trying!
I read Stephen King's book On Writing, he described the development of the story as carving something out of stone. You just start hammering the hell out of the block then it just starts resembling an image (something like that).
My reaction was "Haha, that's what I do when I write code"
Only when I read that book I realised that that might be the reason why I don't look forward to finishing projects - hammering away is fun.
I love working on the heavy parts.
Refactoring, getting rid of code, Visual Studio Code that sometimes does magical stuff, having tests passing and how easier things are now that I'm using a 24" inch monitor again instead of the Macbook's 13" :D
I absolutely love getting to build things from the ground up. Some of my favorite things I've done at my job were things I had to start from scratch. I enjoy most coding tasks, even fixing bugs, but my favorite by far is seeing a feature or product I helped make with no code to start out with.
An office with a door, so I can focus.
My guilty pleasure is I enjoy fixing bugs. Each bug is like a mini-puzzle, and (usually) is apparent whether or not it is fixed or still broken.
Two large monitors. And I'm super particular about keyboards. (IBM Model M forever!)
Clean code makes me happy. I wish there were refactoring tools for C++, like I had JetBrains ReSharper for C#.
The one surprise I had was how much I enjoyed TDD using C#, NUnit, and the awesomely amazing test-runner NCrunch. I really miss that now that I'm back in C++.
Endless supply of Diet Mountain Dew.
Love fixing bugs too!
If it's not a trivial bug you usually learn A LOT chasing a bug. Sometimes you end up with patches to third party libraries, sometimes you end up with more insight about the framework or the language or even parts of your own code you forgot about :D
My two favorite bugs was finding a bug in the compiler (can't remember which compiler anymore, too many years ago - I'm sure it was not GCC), and finding a bug in the gdb debugger.
so "meta" :D
Lining stuff up vertically. Whether it's the values in
key->value
literals, wrapped method parameters, class members, or anything else, everything is just so much nicer to look at when it's all lined up vertically.Getting a pull request merged
Just had my first one yesterday and holy shit I'm still riding that high.
Aha moments!
Fixing up brittle, archaic tests so that they're fast and much easier to follow and iterate on.
In general just getting things to a more maintainable state for the future (probably due to joining teams where the codebase I have to grok is nearly impenetrable).
Coming back to old code after learning something new and applying it there. Feels great and makes me feel like I'm progressing, especially since I want to do this for a living and I only do it as a hobby at the moment.
Really basic but, autocomplete is the little thing that gets me going the most. That breeze you get when you press Tab and the function appears, is something magical.
Context: I've been coding for a little more than a year, being self taught, I discovered autocomplete like two months ago.
It's very useful! Since i have to change languages from time to time it's a challenge to memorize what it will autocomplete and if it will be the same that i want hehe
Making my code read like a book?
Something like:
Instead of spaghetti code:
I like testing with silly content, be it inside jokes as a message to see if a component has rendered, or injecting cat pictures as place holders.
My all-time favorite is adding in a marquee tag that scrolls by with "H E L P" in big letters when working with something that's been frustrating me. It never gets old, for some reason, and it helps me feel like I'm in less of a rut.
No bugs ??? Thats a dream
But working in a peaceful environment , keeps me calm.
Already answered Stack Overflow Questions. If not how will I solve a problem ?
Refactoring code . Sure that helps better understanding.
Comments in code. But who are properly doing it.
My guilty pleasure is replacing large external dependencies that were included just to avoid writing a few lines of code oneself with said few lines.
The last codegasm I had was when I replaced the whole of moment.js in an app where it was only used to format the users' time zones for tracking purposes with 4 short lines of script. Boom, 60kb less for the user to download.
Yes, I know there's NIH (not invented here), but sometimes I feel like that's just an excuse for being lazy and using overengineered solutions for simple problems.
The first time something moves when making a game (especially with a new Lib/Lang/Engine/Framework)
When a complicated VIM-Command/Macro just works as intended
When I write really badly formatted code and Prettier/Gofmt makes it nice after saving.
TFW I realize "oh I can get rid of those 50 lines of CSS" and I type 50-D-D-Esc-:-w
(Delete 50 lines and save the file)
Finding someone else has the same, unanswered problem on Stack Overflow and remembering once you've solved it to go back and explain what you did with examples. Doesn't happen to me often enough, but it's a good feeling.
Coding without refreshing, lol. I would try to go as far as I can on a feature without loading the changes.
I just love when I learn some trick or new feature or concept in some basic tutorials or article, and then one day working, I run into situation and realize that I can actually use it in my project (or it even solve some big issue) :)
Finding a library like Polly. It provides a variety of resilience strategies in a composable way. Think of retry, fallback, circuit breaker etc. The documentation is excellent.
It made me happy because it allowed me to deliver a much better quality solution than I could have rolling my own, especially 'within scope' for the task at hand.
1) Automated testing and linting in a neat DevOps pipeline 🤤🤤🤤
2) I have not looked back since I started using the Microsoft Sculpt Ergonomic Desktop kit 3½ years ago.
3) 2 pivoting monitors with one in portrait mode. Each at least 27" and 2560x1440.
There are two main things that make happy while coding.
1) Candy and junk food in the workplace.
2) When we have a situation that really needs to be resolved and I can resolve it with a good, reusable code.
Feeling all smart and professional. Much of my life had me feeling looked down on by people older than me. Being in control of complex code and in the flow of all the knowledge and information makes me feel like someone worth taking seriously :)
I enjoy that moment when working on one language/project and suddenly something in a different language/project becomes clear.
That and when something extremely difficult and frustrating suddenly makes sense and becomes simpler.
Having a strange idea popping in my mind, immediately starting to code something and having some very basic structure that does the job, a few hours after.
Refactoring tests so that editing or adding tests are not a pain then in the ass anymore. Using stuff like Page object pattern when I need to refactor UI tests.
When another dev discovers your refactoring or implementation and thanks you for making their life easier. That's the best way of making me happy, I think.
Booting up the computer, open up the project I was working on and knowing exactly what I want to do.
Afterwards I'll likely make some refactoring to make sure it is modular and easy to upgrade.
Yeah! Same guilty pleasure there. Even though refactoring will take time, I'll take it. Just to make the code smooth and beautiful. 😌
The sound of the stroke keys ... especially when the flow is uninterrupted.
Well, for me it's a warm cup of tea (or lemon juice in summer) while listening to the right kind of music. That helps me focus on the task at hand.
Believe it or not ChillHop/LofiHipHop + Coffee = #BlissLife
Has nothing to do with coding but sure helps while building the PRETTY part of a website in CSS lol
It can be pretty basic but what I love the most is running that heavy, bothering and complicated problem I had working smoothly.
Getting an error. It makes me happy that I have this opportunity to learn about what I did wrong and improve. And then when I’ve fought through them all, it feels so good when it works.
what do you mean saying "Gering" ?
Oh sorry I mean ‘Getting’.
Rewriting code that I wrote 10 years ago and realising just how much better I've got at this.
I used to be really concerned with proper indentation, now Prettier handles that for me and that makes me really happy.
Continuously seeking ways to lessen load times and memory consumption! Ahh best days!
Segmentation faults
Writing some test code quickly without any syntax checking from the IDE and it working like a charm the first time I run it.
Finding that past-me has already implemented stuff I want to implement.
"So, and for the rest of the day... oh well guess work is done for today!"
Getting my team to use new tools I built to make them more efficient. Be that classes that help accomplish some repetitive thing, better CLI tools, some sort of CI automation, or whatever.
I love when someone hands me a paper document to fill out or for information. Every time I see this as an opportunity to show them how it could be done with web or mobile.
echo "This post is in 3D format";
😂
Finding a bug after hours of looking up for it.
Finding a big after a really short time of looking for it.
Guessing by a first attempt what a code (not mine) does.
The clicks I get when I understand what I discovered.
Firstly, no warnings and red squiggly lines. My code compiling. Passing unit tests. And not forgetting a cup of coffee too.
alcohol. mostly.
I love learning something new, be it a new design pattern, framework, design pattern, programming language...
Seeing the application work and be built piece by piece. Being able to write code using design patterns and writing unit tests, and see good coverage.
+1 on this!
When I finally solve that one problem that had me stumped.
Or those 'I didn't think that would work' moments lol
When your code runs perfectly in the first time, there is no words to describe the feeling