Code Refactoring 12

Get the Code:

In this code refactoring tutorial, I’ll show you how to eliminate large Accumulation Methods by Extracting Methods and Using a Collecting Parameter. It sounds complicated but it isn’t!

This tutorial will show you another way to make your code more readable. It will also introduce you to a few jargon terms you will need to know for the future. This video is shorter than normal to focus on topics you need to understand. The code above will help you master this topic.






43 responses to “Code Refactoring 12”

  1. kooboolc Avatar

    I'm watching these tutorials 1.5 times faster. You sound just like King Joffrey. Hope that's just a coincidence 😀

  2. syzer Avatar

    PHP implementation of this toString() has 4 to 5 LOC, so splitting is not advised

  3. syzer Avatar

    In fact you became a really good coach/teacher.

  4. Derek Banas Avatar

    Thank you 🙂 it's fun covering topics nobody else does

  5. Mladen Uzelac Avatar

    Totally cool refactoring. 😎

  6. Derek Banas Avatar

    Thank you 🙂 I'm doing my best to keep them around 15 minutes long. I'm getting better at teaching this topic. After this I think I can teach anything!

  7. Derek Banas Avatar


  8. Viral A Avatar

    Domo arigato Sensei ≧^◡^≦

  9. Derek Banas Avatar

    Thank you very much 🙂 I'm very happy to be able to help people

  10. XonicDigifact Avatar

    Yes, your different. You explain things clearly and make difficult concepts become easy for everyone to understand. Very few people have that ability, and even less are on youtube. You have an amazing talent, and i'm so glad to see you are putting it to amazing use!

  11. Fredrik Westman Avatar

    You dont have to live like that to live without money. The only thing you have to do is eliminate all the outgoing costs that is essintial to live ( food, electricity, water). When you do that, money wont matter anymore. Sure you will still make money, if that is what you choose, but you dont need it to live anymore. You can use it to do fun stuff.

  12. Derek Banas Avatar

    You can go that route. My great grandparents lived off the land without money. I lived that life in my youth in a cinder block house eating nothing but deer meat. It made me feel like I was nothing almost like an animal. I wouldn't look down anyone like that though if they were happy. I just feel that everyone I meet isn't happy. That is why I work so hard to teach people to feel proud about what they can do. When you can do something great money just comes to you

  13. Fredrik Westman Avatar

    How about a life without money 🙂 ? Money is after all, a human invention.

  14. Derek Banas Avatar

    I think anyone can do that if they focus at being great at just one thing. There was a video floating around about imagining what life would be like if you didn't have to think about money. There is a pretty small amount that you have to make to make money not matter anymore. If you focus on doing that then you have complete control. I can now help business owners stay in business, provide a free education, train unemployed people, etc. I could have never done these things without that plan

  15. Fredrik Westman Avatar

    yh, but i dont think you understod what i ment. Kinda hard to explain. I guess we are both no arguing about what makes you happy, rather what removes the things that makes you unhappy. nlp was you way to pull that off. But in my eyes that merly playing the game and winning. Winning the game implies that there is somebody that looses it. I dont want to win or lose. I want to beat it and play by my own rules 🙂

  16. Derek Banas Avatar

    I guess I didn't explain myself. By seeing how easy everything was I freed myself from wanting what society told me I needed. I now am not rich by any means, but I have enough. I met my wife and feel in love without nlp. I also now have children and I agree with everything you said. I just don't think I could have ever freed myself from life's tricks without nlp. Everything is about bettering yourself my mirroring others success. It is very enlightening. I hope that makes sense

  17. Fredrik Westman Avatar

    happiness on the other hand, that comes from a completly diffrent place. Having kids, meeting a person you like, doing what you love. I guess it is diffrent for every person 🙂

  18. Fredrik Westman Avatar

    Thats a interesting story. But i dont agree with you. Sure nlp brougth you money and influence. But dont fool yourself in to thinking that is why your happy. Many think money is a way to happiness, but they are wrong. Money merly enables your rigth to live. And that is a curse. My goals dont lies within money, it lies beyond that. To free myself from that curse. But to do that you have to play the game. That was why i was interested in nlp.

  19. Derek Banas Avatar

    After HS I was average. After NLP I turned to the dark side. I remade my body and picked up girls with ease. Then I fell out of it. Then again average I used NLP in some sales scripts. I was in demand and spent many years making nice money while working a few hours a week. I eliminated all of my personality issues. I again feel out of it until a few years back after a car wreck. I remade my whole life again and now am essentially retired at 38. I wish I could get more people to do it 🙂

  20. Fredrik Westman Avatar

    ok, interesting 🙂 i bougth a couple of books about it but i dont know if they are any good, just the usual help- yourself books ect. . Havnt got around to read all of them yet. key to happiness? maby for some people. I think there isnt really any key. Mabey trying not to live in dogma. In what aspects did it make your life better?

  21. Derek Banas Avatar

    I'm talking about using QM for just about any simulation I could ever be interested in. As per nlp, I think it is the key to a happy life. Nlp changed my life so dramatically I can't even put it into words.

  22. Fredrik Westman Avatar

    But yh, its not like you can use it for any social situaion, pratical situation 😛 And hypnotheraphy sounds intresting. A while back i was very intrested in NLP

  23. Fredrik Westman Avatar

    well, dont get ahead of yourself now 😛 quantum mechanics is behind the invention of the transistor 😛 without it = no computers 😛 It also got several other useful area (lasers, clocks ect.) but computers is the biggest 🙂 Read the other day that they manage to teleport information by entagleling to superposition particals then teleport the information of the state when observed. This is the key to unlock instant internet 😛 100/100 mb will look lik 56k in the future 😛

  24. Derek Banas Avatar

    Physicists look at the world in a very strange way. I had a conversation with one the other day about how worthless quantum mechanics is for any useful situation. I believe that the way people store information is very simple. This comes from research I did when I was heavily involved in hypnotherapy. I believe Jeff Hawkins is right about how the brain works. Everything I ever saw backs it up anyway. If he is right image recognition is key to AI

  25. Fredrik Westman Avatar

    well. im srry to say, no. I saw a documentary with micho kaku ( famous physisist) the other day, and he talk about AI abit. according to him, the intelligence of todays computers is about the same as it is on cockroaches:( if that is true that is.

  26. Derek Banas Avatar

    China must have considered my site as dangerous as the NYT and the WSJ 🙂

  27. Derek Banas Avatar

    I've been playing around with software that can analyze photos and then store information much like people do. This is obviously very complex. Supposedly Google has been successfully working on this for many years. They are pulling away from the old tired ways of implementing AI. I would bet that we are very close to creating a truly intelligent computer right now if it hasn't already been done

  28. Derek Banas Avatar

    You're very welcome 🙂

  29. Derek Banas Avatar

    You're very welcome. I'll continue to decypher the refactoring to patterns book. I didn't realize it was considered to be such a confusing book.

  30. Derek Banas Avatar

    Yes StringBuffer methods are synchronized and that makes them slower. In this situation StringBuilder normally makes sense, but I used StringBuffer out of habit. The performance difference is negligible either way

  31. dasten123 Avatar

    lol newthinktank,com is blocked by Google, it's on the "Reported attack sites" – list °_° wtf?

  32. dasten123 Avatar

    Cool it really became more readable
    But isn't StringBuilder a better choice than StringBuffer because it's faster?

  33. Fredrik Westman Avatar

    I promise if i manage to pull that one of i will donate 10 % of everything i earn to you for this wonderful project 🙂 so the show can go on ^^

  34. Fredrik Westman Avatar

    🙂 i think something that is important and up and coming is how to create recognition programs, and i bet they dont teach about that anywhere eiher 🙂 I meen it dosnt seem like it now, but the smartphone is dying. give it 10 years and we will look at them like we do with buttons phones today 🙂 then its all about glasses 🙂 and they will need apps 🙂 how to detect stuff and so on 🙂 why not start preparing the "Identify hot singel babes" app that you know every mindless drone will want later 😛

  35. Derek Banas Avatar

    I never realized that this topic isn't really taught any other place. It seems like most people don't understand the only book written on the topic as well. I'll do my best to make refactoring to design patterns understandable. I am very happy that I have some people watching 🙂

  36. Derek Banas Avatar

    ຂ້າພະເຈົ້າຍິນດີທີ່ສຸດທີ່ເຂົາເຈົ້າຊ່ວຍໄດ້. ຂ້າພະເຈົ້າໄດ້ຄົ້ນພົບວ່າແມ່ນຂໍ້ມູນທີ່ບໍ່ເຄີຍມີສອນທຸກບ່ອນອື່ນ. ຂ້າພະເຈົ້າຈະສືບຕໍ່ກະທູ້ນີ້ຈົນກວ່າຂ້າພະເຈົ້າໄດ້ກວມເອົາມັນຫມົດ

  37. 123japanuser Avatar





    ໄດ້ມີການຂຽນຫຼາຍຕົ້ນ: (


  38. Fredrik Westman Avatar

    I guess your the hero we need rigth now but not the one we deserve 😛 And yh it has its ups and downs, more effective and personal when one is able to communicate with a majority of the subscribers. But on the other side, you deserve ALOT more subscribers. But its just this kind of work we need rigth now , as a race, civilization type 1 information and learning flow. Things like this will be apart of creating the future 🙂

  39. Derek Banas Avatar

    I don't think that would be considered a refactoring per se. I'll get into programming best practices like proper exception handling soon enough. My channel is starting to feel more and more like a private club to me than a YouTube channel lately. It is pretty easy to get rid of subscribers with the following phrase "In this code refactoring tutorial, I’ll show you how to eliminate large Accumulation Methods by Extracting Methods and Using a Collecting Parameter…. (UNSUBSCRIBE) 🙂

  40. Derek Banas Avatar

    You're very welcome 🙂 I'll cover all of the major refactorings before I quit. I started studying this stuff so that my code would stand out when I was still young. Code aficionados go crazy when they see code like this. I'm glad I'm able to add to what you're learning in college

Leave a Reply

Your email address will not be published. Required fields are marked *