#DevDiscuss Archive


Tuesday February 13, 2018
9:00 PM EST

  • ThePracticalDev Feb 13 @ 9:06 PM EST
    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?
  • ThePracticalDev Feb 13 @ 9:06 PM EST
    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 😄)
  • kvlly Feb 13 @ 9:07 PM EST
    Refactor early, refactor often. #devdiscuss
  • Wintermute21 Feb 13 @ 9:07 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • morphosis7 Feb 13 @ 9:08 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • 5paceToast Feb 13 @ 9:09 PM EST
    Just. DO IT #devdiscuss
  • Wintermute21 Feb 13 @ 9:10 PM EST
    Also, you carve out time by doing it. #devdiscuss
  • bendhalpern Feb 13 @ 9:11 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • davidgagne Feb 13 @ 9:12 PM EST
    Always refactor in a new branch! #DevDiscuss
    In reply to @ThePracticalDev
  • cjbush Feb 13 @ 9:12 PM EST
    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
    In reply to @ThePracticalDev, @zeotherm
  • morphosis7 Feb 13 @ 9:12 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • joshin_my_tots Feb 13 @ 9:13 PM EST
    #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.
  • _ropthe_ Feb 13 @ 9:13 PM EST
    #DevDiscuss if you don’t refactor, you end up with this
    In reply to @ThePracticalDev
  • bendhalpern Feb 13 @ 9:14 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • sikachu Feb 13 @ 9:14 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • yowify Feb 13 @ 9:14 PM EST
    Can refactoring be considered a sutile form of procrastination? #DevDiscuss
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • whosbacon Feb 13 @ 9:14 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • iTMayzIII Feb 13 @ 9:16 PM EST
    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
    In reply to @ThePracticalDev
  • zeotherm Feb 13 @ 9:17 PM EST
    #hedonismbot #devdiscuss
    In reply to @cjbush, @ThePracticalDev
  • _ropthe_ Feb 13 @ 9:17 PM EST
    #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.
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • kylegalbraith Feb 13 @ 9:17 PM EST
    Refactoring is important because it is just good hygiene. Code is always evolving and its good practice to keep it fresh. #DevDiscuss
  • morphosis7 Feb 13 @ 9:17 PM EST
    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.
  • zeotherm Feb 13 @ 9:18 PM EST
    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?
    In reply to @ThePracticalDev
  • kylegalbraith Feb 13 @ 9:19 PM EST
    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
    In reply to @ThePracticalDev
  • _ropthe_ Feb 13 @ 9:19 PM EST
    #devdiscuss this is great. I want to add that you should also always have tests in place first! Even if they are large and ugly and semi-manual.
    In reply to @davidgagne, @ThePracticalDev
  • jeffporper Feb 13 @ 9:19 PM EST
    Always, I mean never...Forget to check your closure #DevDiscuss
    In reply to @ThePracticalDev
  • philibertdugas Feb 13 @ 9:19 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • kylegalbraith Feb 13 @ 9:20 PM EST
    One trick I use...check how many places a particular function is referenced. If it is 100+, you need more time. #DevDiscuss
    In reply to @ThePracticalDev
  • kvlly Feb 13 @ 9:20 PM EST
    The best time to refactor your code is when it's still fresh in your mind. Got what you wanted to work properly? Great! Time to refactor. #DevDiscuss
  • vijayasankarv Feb 13 @ 9:20 PM EST
    I posted this rant 8 years ago https://t.co/YrKYEdeILC #devdiscuss
    In reply to @ThePracticalDev
  • sikachu Feb 13 @ 9:20 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • kylegalbraith Feb 13 @ 9:20 PM EST
    100% agree with this #DevDiscuss
    In reply to @sikachu
  • bendhalpern Feb 13 @ 9:22 PM EST
    My favorite refactoring primer I've come across https://t.co/sZN5uJGuzn #DevDiscuss
  • testingrequired Feb 13 @ 9:22 PM EST
    #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.
    In reply to @ThePracticalDev
  • kylegalbraith Feb 13 @ 9:23 PM EST
    When you open a new code base and see it has probably never been refactored... #DevDiscuss
  • TheOriginalBPC Feb 13 @ 9:25 PM EST
    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
    In reply to @ThePracticalDev
  • isaacandsuch Feb 13 @ 9:27 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • Programazing Feb 13 @ 9:27 PM EST
    No #DevDiscuss for me tonight.
  • _ropthe_ Feb 13 @ 9:27 PM EST
    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.
    In reply to @iTMayzIII, @ThePracticalDev
  • isaacandsuch Feb 13 @ 9:28 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • Ld00d Feb 13 @ 9:29 PM EST
    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
    In reply to @ThePracticalDev
  • codingwcookie Feb 13 @ 9:30 PM EST
    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
    In reply to @ThePracticalDev
  • SeanMP Feb 13 @ 9:30 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • Lowki_Chi Feb 13 @ 9:31 PM EST
    Refactor often, code doesn't age like a fine wine #devdiscuss
  • Davkas2005 Feb 13 @ 9:31 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • IBeRenascent Feb 13 @ 9:32 PM EST
    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
    In reply to @ThePracticalDev
  • jordanpittman Feb 13 @ 9:32 PM EST
    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
    In reply to @sikachu
  • _ropthe_ Feb 13 @ 9:36 PM EST
    This is great! There’s a reason why naming is the second chapter of Clean Code! #devdiscuss
    In reply to @isaacandsuch
  • morphosis7 Feb 13 @ 9:37 PM EST
    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
    • IBeRenascent Feb 13 @ 9:32 PM EST
      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
      In reply to @ThePracticalDev
  • _ropthe_ Feb 13 @ 9:39 PM EST
    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
    In reply to @kvlly, @eklect
  • living_syn Feb 13 @ 9:40 PM EST
    Refactoring == admitting you didn't do it perfect the first time. #devdiscuss
  • ThePracticalDev Feb 13 @ 9:40 PM EST
    How do you best communicate the value of refactoring to non-technical stakeholders? #DevDiscuss
  • Universe_FD Feb 13 @ 9:40 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • _ropthe_ Feb 13 @ 9:41 PM EST
    And if you don’t have tests, write them before you try to refactor!!! #devdiscuss
    In reply to @isaacandsuch
  • kesh_char Feb 13 @ 9:42 PM EST
    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
    In reply to @ThePracticalDev
  • marcoslhc Feb 13 @ 9:42 PM EST
    Never let the test coverage drop #DevDiscuss
    In reply to @ThePracticalDev
  • kylegalbraith Feb 13 @ 9:42 PM EST
    Technical debt is the best way I have found. Or articulating why a piece of code cannot scale or be maintained for future customer growth. #DevDiscuss
    In reply to @ThePracticalDev
  • SKisContent Feb 13 @ 9:43 PM EST
    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
    In reply to @ThePracticalDev
  • Nick_Craver Feb 13 @ 9:44 PM EST
    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
    • ThePracticalDev Feb 13 @ 9:06 PM EST
      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?
  • Programazing Feb 13 @ 9:45 PM EST
    Check out my website/blog at https://t.co/4DAQVTUa1s #DevDiscuss
  • PavelPatino Feb 13 @ 9:45 PM EST
    Beauty is in the eye of the beholder. Solve a problem while refactoring - don't just do it because the code could read prettier #devdiscuss
  • kvlly Feb 13 @ 9:46 PM EST
    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
  • bendhalpern Feb 13 @ 9:47 PM EST
    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
  • morphosis7 Feb 13 @ 9:48 PM EST
    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
  • _ropthe_ Feb 13 @ 9:49 PM EST
    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
    In reply to @kvlly
  • KrisSiegel Feb 13 @ 9:50 PM EST
    "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
  • Nick_Craver Feb 13 @ 9:50 PM EST
    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
  • morphosis7 Feb 13 @ 9:50 PM EST
    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
  • RCamperoTuc Feb 13 @ 9:51 PM EST
    Isolate your refactoring changes in specific VCS commits, do not mix them with other (feature/bugfix) modifications. #devdiscuss
    In reply to @ThePracticalDev
  • _ropthe_ Feb 13 @ 9:52 PM EST
    Or if you don’t want to let yourself be vulnerable, refactoring is admitting you didn’t have all the information the first time #DevDiscuss
    In reply to @living_syn
  • lT0mm Feb 13 @ 9:52 PM EST
    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
    In reply to @ThePracticalDev
  • living_syn Feb 13 @ 9:52 PM EST
    you mean the requirements CHANGED?!?!?! #devdiscuss
    In reply to @_ropthe_
  • Nick_Craver Feb 13 @ 9:53 PM EST
    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
  • ThePracticalDev Feb 13 @ 9:54 PM EST
    In the last few minutes of #DevDiscuss, anybody have any news to share, like a project or a personal win, or any other announcement?
  • Nick_Craver Feb 13 @ 9:54 PM EST
    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
  • OngEmil Feb 13 @ 9:56 PM EST
    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
    In reply to @ThePracticalDev
  • lodemiguel Feb 13 @ 9:57 PM EST
    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
  • Nick_Craver Feb 13 @ 9:57 PM EST
    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
  • kylegalbraith Feb 13 @ 9:59 PM EST
    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
  • chris_neff_pgh Feb 13 @ 9:59 PM EST
    Without refactoring to support adaptability in your codebase, your team output will approach absolute zero #DevDiscuss
    In reply to @ThePracticalDev