Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
The chat will last about an hour and we use the #DevDiscuss tag.
Rules:
- Stay on topic
- ALWAYS ALWAYS use hashtag #DevDiscuss
- Be NICE/POSITIVE ❤️
- Quoting tweets for clarity is encouraged
(ALWAYS use the #DevDiscuss, even on replies where appropriate 😄)
Refactoring is important because writing good code is like revising an essay and both of them need to be done for similar reasons. Advice? Learn @resharper well. #DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
For me, refactoring is important because you want to apply the lessons you learned when you wrote a piece of code the first time. Ideally, you do it before you forget those lessons (like a rough draft/final draft). #DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
We can all stand to practice some feature minimalism and spend more time improving on the code we already have. Clean code, well tested and/or monitored code is the only way to build good software. #DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
Refactoring is important so you’re not stuck supporting 35 year old Fortran code that writes and compiles Fortran code. Not that I know anything about that. @zeotherm#DevDiscuss
How do you carve out time for refactoring? Good question. Some options:
- Pad your time estimates slightly during project scoping (if possible)
- If you're fortunate enough to have discretionary time, that's a great opportunity.
#DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
#DevDiscuss Usually when writing code, I like to write it and make it all work. Then I write unit tests. Then I refactor to make it better. Then you can verify that the code still works by running your tests. Often you can even find other test scenarios.
Reliable tests, CI, and monitoring make refactoring such a pleasurable activity. Dip into some code and improve it, then commit and move on. The more you refactor, the better the refactoring gets. #DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
The best time to refactor is when I'm fixing a bug or adding a new feature. I usually just put it in a commit _before_ my actual fix/feature.
Don't put it off, because it will never get done otherwise.
#DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
My own rule is: If the module is more than 100(-ish) lines, it can / should be refactor into 2 or more. Sadly, that rule seems to only works for #python#devdiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
I want to clarify for new developers. Refactoring is not making code have less lines, instead refactoring is the art of changing code to make it more readable and yet still do the same thing :) I repeat, it should do the SAME exact thing in the end.
#DevDiscuss#2cents
#DevDiscuss refactoring doesn’t have to be some big event that you schedule a month in advance. Just like writing tests as you write code, part of development is continually refactoring and refining your designs.
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
My personal follow-up question for #DevDiscuss - is there a minimum amount of time you should wait before refactoring? Does distance from the initial writing make refactoring easier? I suspect so - like any design project, you have to step back and then back in.
Why fix what I can do in a morning today, when I can make some poor sap spend six weeks doing it many years from now? #DevDiscuss
.... is that not how it works?
There is a balance to refactoring though. You have to know whether or not you are refactoring something that has a pit of rattlesnakes behind it. #DevDiscuss
When the refactor feels overwhelming I create a scrappy PoC to see the whole picture, I then start shipping small pieces of the work until there’s nothing left in the branch 🤓 #DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
Speaking of which, I've been in so many teams which has a "All PRs must have a reference issue/ticket" rule. That discourages refactoring, and make people unable to make improvement to the code.
If your team still has this rule, maybe it's time to reconsider it!
#DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
#DevDiscuss I love refactoring. I'll refactor the world without restraint. Refactoring means understanding the code base. It also leaves it cleaner (hopefully).
Tips: Refactor on separate commits or branches. Don't change functionality. Have unit test coverage.
Refactoring means much more readable code that is tries to be clear as possible what is happening in a program. When I refactor my code, I just ask myself if certain parts of my code could better #DevDiscuss
A good "first refactor" for beginners is to change a non-descriptive variable name (like "x" or "first") to a descriptive variable name (like "customer" or "regexMatch"). Easy to do, but saves your brain a little work each time you read that piece of code. #DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
Readability is definitely a primary goal, but enabling reusability by making the existing structures is also up there. #DevDiscuss.. Maybe they are still one and the same.
When you refactor, your test suites earn their keep. If you have good, interface-focused tests, you can refactor quickly and confidently. The tests will tell you if you broke something or forgot a piece. #DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
If it's code you don't like that's doing its job. Leave it!
If it's code you don't like that needs to also do this other thing? Refactor away!
#DevDiscuss
I like to refactor code once I have the initial functionality working. I refactor code to make it more understandable, concise, and readable to my future self and anyone else looking at at the code. #DevDiscuss
Not every refactoring attempt, especially the larger ones, will succeed. Don't be afraid to bail, and don't let it discourage you from future cleanup. #DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
I view refactoring like I do keeping a clean desk. Do a little work each day to keep your desk clean, you have a better working environment. Leave it too long, and it becomes a cluttered mess that is harder to find things in.
Refactor now = quicker fixes later.
#DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
Refactor when it'll make things more clearer or maintainable, *not* because you think you know better than all the other developers who worked on it prior (lessons we've had to teach to interns) #devdiscuss
Absolutely this. I have many commits that say “Refactor” just before one or commits relating to features or fixes. It’d be interesting to run some stats on these.
#DevDiscuss
I _definitely_ agree with this. Refactoring should not be about "watch how clever I can be" (IMO, at least). Others have also commented how refactoring should improve readability. #devdiscuss
Refactor when it'll make things more clearer or maintainable, *not* because you think you know better than all the other developers who worked on it prior (lessons we've had to teach to interns) #devdiscuss
This. If you wait too long, you’ve lost touch with how it works. Then you have to relearn it to refactor so that it’s easier to for the next person to learn. You just played yourself. #devdiscuss
Refactoring is important when you're on a team of developers. Make your code clear for your dev partners usually improve the whole team's efficiency.
#DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
Refactor code only after getting an complete overview of how the end result looks like, don't do it just to implement some new design pattern or some new technology #DevDiscuss
To me all coding is refactoring, even when there is no code to start with, and it starts with adequate tests to show that the code is still behaving as expected.
#DevDiscuss
1. Uses of code (and infrastructure) change. They need to change to better support current cases and drop cruft from old ones.
2. Time MUST be allocated for all tech debt. You'll pay with more time if you don't.
3. Pieces as small as practically possible, always.
#DevDiscuss
Hey folks! Time for #DevDiscuss an hour of delightfully delicious dev discussion.
Tonight's topic is REFACTORING
Here are some jump-off questions:
- Why is refactoring important?
- How do you carve out time for refactoring?
- What are your refactoring tips?
Imagine grabbing everything you need for a 5 day business trip and throwing it into your suitcase. Everything that you need is in there, right? Now organize it all so you can easily grab clothes for tomorrow without pulling everything out.
Boom. Refactoring.
#DevDiscuss
Getting more people involved and talking about the process. Let's share stories about great code with more people. Buy in leads to good results #DevDiscuss
This will change based on context. If you're at the start of a project, then the narrative is about enabling the project to proceed more smoothly.
if you're refactoring outside the bounds of a project, that's trickier. Discretionary time? Skill-building?
#DevDiscuss
I like this analogy. If you’ve never been backpacking, you don’t know the best way to pack things, but over time you learn better organizations. The slow process of learning and adapting IS refactoring #DevDiscuss
"You know those X, Y and Z features you eventually want? Well, if I refactor A, B and C it will make it much easier for me to later implement those for you. Also, it'll be easier to test and as an added bonus new devs will be able to jump into this logic much faster"
#DevDiscuss
The majority of my job for a long time now is refactoring code and infrastructure to better support what Stack Overflow needs today and wants tomorrow. I believe this is absolutely necessary, lest we all drown in debt and mire in burdens of the past.
#DevDiscuss
The trap I think you want to avoid is being seen as letting the perfect be the enemy of the good. Don't keep refactoring only to see ever-diminishing returns, while bigger problems/projects fester.
#DevDiscuss
difficult for me,several signs for consideration
A. Code is difficult and I can improve it
But that is not enough reason so what else:
B. That code likely will change
Or
C. It is important code for understanding other parts
but with time for refactor even harder 😔#DevDiscuss
The trick to tech debt is you need to look ahead, not behind. It's easy to see all the things you know can be improved, but the priority of that list comes from: "which areas will cause me pain tomorrow?" Those are your first TODOs. Get started today.
#DevDiscuss
And don't judge old code. You know more than they did. Or less. You don't know. Just fix it and move on. Blame helps no one. It only wastes time and morale.
#DevDiscuss
Debt is a great analogy for a choice you made ahead of time, but I like to differentiate between that and code which is becoming less well-suited to its task over time, be that in maintenance terms or user-facing functionality.
Maybe call it "code rust?" #DevDiscuss
IDEs refactoring tools are great, they won't introduce compiling errors, refactoring without unit tests increase your odds to stub a toe in a dark room. Each refactor is a great chance to write those missing tests! #DevDiscuss
If you find your own mistakes in code, especially funny ones: share them with your team. We're all human. Laugh at your mistakes, fix them, improve. This helps impostor syndrome and may save someone else from repeating.
#DevDiscuss
I finished the last chapter of my upcoming book on learning AWS by actually using it. Still needs to go through editing and I have screencasts to record, but a ton of progress already this week. https://t.co/10z3dHzE5Z#DevDiscuss