#6 in Computer programming books
Use arrows to jump to the previous/next product

Reddit mentions of Refactoring: Improving the Design of Existing Code

Sentiment score: 45
Reddit mentions: 76

We found 76 Reddit mentions of Refactoring: Improving the Design of Existing Code. Here are the top ones.

Refactoring: Improving the Design of Existing Code
Buying options
View on Amazon.com
or
    Features:
  • Addison-Wesley Professional
Specs:
ColorCream
Height9.25 Inches
Length1 Inches
Number of items1
Weight2.0502990366 Pounds
Width7.5 Inches

idea-bulb Interested in what Redditors like? Check out our Shuffle feature

Shuffle: random products popular on Reddit

Found 76 comments on Refactoring: Improving the Design of Existing Code:

u/_a9o_ · 188 pointsr/cscareerquestions

Refactoring: Improving the design of existing code

Design Patterns

Working Effectively with legacy code

Clean Code

How to be a programmer

Then there are language specific books which are really good. I think if you read the above, slowly over time, you'll be in a great place. Don't think you need to read them all before you start.

u/Nezteb · 43 pointsr/compsci

Some book recommendations:

u/ThereKanBOnly1 · 35 pointsr/dotnet

Literally every part about this sounds like an up hill battle. Frankly, no matter what the course of action, a year isn't going to be enough. You've got to start tempering expectations with that now.

The challenge here is rewriting all that Web Forms logic, and this is the piece that is the biggest hurdle. I assume, that since you are working with web forms you don't have any test suite in place, so you're basically walking a tightrope without a net. I also assume that the actual business logic of the application is probably closely intertwined with web forms as well (which I'm assuming because that's how its been nearly every web forms app I've worked with).

Before you start wondering with MVC is the right fit for you, you've got to prepare your code base from moving out of Web Forms. You should pick up Refactoring by Martin Fowler. And begin to move as much code as you can out of code behind files, and into pure C# classes that you can test. Interfaces are your friend. Facades and Adapters are your friend. Unit tests are your friend. You need to have your business logic as portable as possible in order to move away from Web Forms and not be constantly chasing down bugs and unexpected functionality. The more your code-behind is a facade that just takes inputs and calls other classes with them, the better off you'll be

With that out of the way, now we can get in the framework discussion. First off, I don't think a SPA is a good approach here. It'll be too heavy of a lift for your team, and probably not worth the time and effort at this point in time. So you're pretty much left with MVC as an architecture, which is fine, but I think you're going to have some issues with "vanilla" MVC considering the load and the users you're going to have to service, so you're going to have to look beyond that to make this work.

One of the key components to scaling this will be a good cache. If every read needs to hit the database, then you're done. I would recommend using Redis for caching, but an in-memory cache will help you here as well.

I would also strongly recommend looking into CQRS. That stands for Command Query Responsibility Segregation. The high level idea is that requests that need to modify data gets handled by different classes than reading data. This makes it much easier to scale up/out the read side, and also makes it much easier to know when the cache on the write side can be invalidated (since that's coming from the read side).

The challenge with ramping up on CQRS is that its generally presented with a lot of other solutions; MongoDb/Document databases, Event Sourcing, event messaging. Those are good and interesting in their own right, but they are way more than you need right now and CQRS does not require using them.

The last thing I'll touch on here is that if you've got one big ball of mud, you're path to upgrading this going to be very tough. If you can find isolated parts of the application to split off, and test in a different framework, then you'll be much better off. The more isolated sales is from inventory (or whatever you have) the better off you're going to be in the long run. If you can find the time to isolate those components in the application now, rather than try and rewrite the big ball of mud, your future self will thank you.

u/jkndrkn · 26 pointsr/programming

Refactoring. I've known many a coder that loves to engage in this most macho of disciplines. Funny thing is, is that many such coders don't use any unit testing. As anyone who has read or at lest skimmed Refactoring
knows that one should not even contemplate making any changes without a solid test suite to catch the inevitable bugs.

Refactoring isn't about engaging in brutal combat with your code. Refactoring is about careful reshaping.

u/masklinn · 25 pointsr/programming

So basically Uncle Bob forgot how to actually refactor, and didn't bother whipping up his copy of Refactoring?

Automated refactoring tool are a good thing, because (especially in statically typed languages) they make refactoring safer (but not safe, if you use e.g. code generation or reflection, your refactoring browser won't help you), more systemic, more systematic and much faster.

But they were never necessary, the basic concepts of refactoring were tool-less, and Refactoring lists only manual recipes (with a discussion on refactoring browsers in another chapter), some of them -- if I remember well, it's been some time since I've read it -- not even being automatically implementable.

u/xnhy · 25 pointsr/coding

I like these and would add:

3) Given how cheap they got lately, I would suggest to use at least two screens for work. More screen real estate equals more efficiency.

4) Master your tools. Memorize the shortcuts your editor provides (or learn Vim :) ), learn to take full advantage of your IDE's debugging capabilities, and so on.


...and regarding this...:
> Design patterns.

Refactoring - Improving the Design of Existing Code is a great book on this topic.

u/cocorebop · 18 pointsr/reactjs

I keep a copy of this book on my desk. I've never read it but I'll be damned if it's not sitting on my desk.

u/dev_bry · 12 pointsr/learnprogramming

You've already done the first step: admitting that college can only teach the fundamentals while the rest of the things you need to know, you will learn while working.

With that out of the way, here's the next step: apply the Joel Test to your new employer.

If it gets an 11 or 12, you'll be fine. Find a senior developer there to mentor you and you'll be a decent software engineer in 1 - 2 years.

Otherwise, while you might learn a lot of new stuff in your first job, they might be inadequate, outdated, or outright incorrect. In this case, plan an exit strategy ASAP so that you can leave to another company that has a much higher score in the Joel Test. In this fast paced software industry, it makes no sense to spend 5 years in a company where you'd only get to grow the same amount as another guy who just spent 6 months in a better company.

Next step: read. No, not those "Teach yourself [insert language that will be deprecated in 2 years] in 24 hours" books - find the books that teach software engineering, lessons that don't get outdated. Here's the usual suggestions:

u/mian2zi3 · 8 pointsr/learnprogramming

I'm reminded of this Ira Glass quote:

https://www.goodreads.com/quotes/309485-nobody-tells-this-to-people-who-are-beginners-i-wish

Are you a professional developer? You might talk to your team lead, manager or other senior engineer on your team about making a plan to improve.

> Death by iteration or death by un-maintainability

Learn about refactoring. This is the classic book:

https://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672

but it is a common idea now. Test-driven development could help with this.

> perfect response with a great code example way better than I could've done it given weeks or months

The key habit here is to ask yourself, "What would I have had to know to come up with this myself?" and then go learn that and internalize it so if you ever see this problem or a related one again, you can solve it. If you do this consistently, you'll have a powerful bag of tools and be able to solve lots of problems easily that you couldn't before.

Finally, it doesn't sound like you have a formal CS education. You might think of going through some undergrad CS courses online (edX, Coursera, MIT OCW, etc.) It takes long-term persistence that few have the patience for, but if you can make it through, they will transform your understanding of computers and development.

u/EughEugh · 6 pointsr/programming

There are several good books on designing good software:

Code Complete

Design Patterns

Refactoring

u/obeleh · 6 pointsr/compsci

Perhaps offtopic but... Some books you should read regardless of CompSci branch

u/DeathByIcee · 5 pointsr/androiddev

Not Android, but, much of what konk3r said in his comment is packaged nicely and easily consumable in Refactoring by Martin Fowler. Before you begin coding Android, understand Java and what it takes to write maintainable code. Any mildly intelligent chimpanzee can write code; it takes a talented programmer to write code that others (or even the dev himself) can maintain.

Other things:

  • Understand list views. They're ridiculously complicated but there are very few apps that don't need them, and I can count on one hand the number of developers in my company that I've come across that can implement them correctly.

  • Model-View-Controller. If you don't know the paradigm, look it up. iOS/Objective-C does a lot better job of lending itself to the paradigm naturally, but that does NOT mean that it is not applicable in Java. Separating your UI from your business logic/data is crucial and will save you SO MUCH PAIN later in maintenance stages.

  • Understand the Activity lifecycle. Re-read the documentation and experiment until you understand its ins-and-outs.

  • Never use hardcoded strings. They're a nightmare to maintain and completely impossible to re-use. For Android, UI strings should go in strings.xml (this means, if text appears in your app UI, it better be a string resource). You may also opt to use them for non-UI things, but I prefer constants in well-named files.

  • Understand when you need application context versus activity context. Understand the differences in the two. Use them appropriately.

  • Android is open source and apps are extremely easy to unravel to their source code, so, don't be shy about pulling down someone else's app and dissecting it to figure out how they implemented that cool functionality. Google's apps especially. Obviously don't commit copyright infringement, but a good programmer knows when to write from the ground up and when to not reinvent the wheel.

  • If you're passing information between activities, use Parcelable, or the Android Gods will smite thee. NOT serializable.

  • Utilize Android's helper classes. Did you know they have a TextUtils class? It is great for String functions (like checking if a string is null or "" with isEmpty();).
u/stannedelchev · 5 pointsr/learnprogramming

All the programming best practices you know apply to refactoring as well.

Use source control (Git, Mercurial, SVN, whatever) and commit often, on your own refactoring branch if possible. This way you can "save progress" and revert any changes, should your code get worse in some way.

Also, test a lot. Both during and after the refactoring. Having automated tests really helps. Make a small change, run the tests, make sure everything works, rinse and repeat.

Martin Fowler and other people have books on refactoring. I'd also recommend watching one of his talks.

Lastly, remember that refactoring is not a one-time thing. It's a frequent, ongoing process.
Make small revertible changes in one unit/module at a time, if possible. You don't want to fall too deep in the rabbit hole, and forget what you actually wanted to change.

u/ckdarby · 4 pointsr/PHP

I have included some links for more information about myself in the original post.

To have a better idea of the type of person I am these are the books within my arms reach right now:

Design Patterns: Elements of Reusable Object-Oriented Software

[Refactoring: Improving the Design of Existing Code](
http://www.amazon.ca/gp/product/0201485672)

The Mythical Man-Month

Along with some other ~50 similar books I've read.

u/ir8prim8 · 4 pointsr/PHP

They are older books, but really changed my way of programming. Refactoring by Fowler and Test Driven Development by Beck.

https://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672
https://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530

Feeling overwhelmed and confused can always be solved by breaking things into small enough problems and making enough tests to make sure that your assumptions match reality.

Frameworks can be confusing the way they hide details away from you. Remember though, that with open source, there is nothing to stop you from digging into the framework methods you are calling and see how they work. If you get stuck, sometimes looking at the source will tell you more than looking at the docs. Try multiple frameworks in multiple languages. Once you think you have an idea of the different parts required, try using a template library and an ORM library and write the rest of the code you need to make a basic custom framework.

If you want to see a more direct approach to web services, take a look at Go, where frameworks are almost discouraged. http://thenewstack.io/make-a-restful-json-api-go/

u/CSMastermind · 4 pointsr/learnprogramming

I've posted this before but I'll repost it here:

Now in terms of the question that you ask in the title - this is what I recommend:

Job Interview Prep


  1. Cracking the Coding Interview: 189 Programming Questions and Solutions
  2. Programming Interviews Exposed: Coding Your Way Through the Interview
  3. Introduction to Algorithms
  4. The Algorithm Design Manual
  5. Effective Java
  6. Concurrent Programming in Java™: Design Principles and Pattern
  7. Modern Operating Systems
  8. Programming Pearls
  9. Discrete Mathematics for Computer Scientists

    Junior Software Engineer Reading List


    Read This First


  10. Pragmatic Thinking and Learning: Refactor Your Wetware

    Fundementals


  11. Code Complete: A Practical Handbook of Software Construction
  12. Software Estimation: Demystifying the Black Art
  13. Software Engineering: A Practitioner's Approach
  14. Refactoring: Improving the Design of Existing Code
  15. Coder to Developer: Tools and Strategies for Delivering Your Software
  16. Perfect Software: And Other Illusions about Testing
  17. Getting Real: The Smarter, Faster, Easier Way to Build a Successful Web Application

    Understanding Professional Software Environments


  18. Agile Software Development: The Cooperative Game
  19. Software Project Survival Guide
  20. The Best Software Writing I: Selected and Introduced by Joel Spolsky
  21. Debugging the Development Process: Practical Strategies for Staying Focused, Hitting Ship Dates, and Building Solid Teams
  22. Rapid Development: Taming Wild Software Schedules
  23. Peopleware: Productive Projects and Teams

    Mentality


  24. Slack: Getting Past Burnout, Busywork, and the Myth of Total Efficiency
  25. Against Method
  26. The Passionate Programmer: Creating a Remarkable Career in Software Development

    History


  27. The Mythical Man-Month: Essays on Software Engineering
  28. Computing Calamities: Lessons Learned from Products, Projects, and Companies That Failed
  29. The Deadline: A Novel About Project Management

    Mid Level Software Engineer Reading List


    Read This First


  30. Personal Development for Smart People: The Conscious Pursuit of Personal Growth

    Fundementals


  31. The Clean Coder: A Code of Conduct for Professional Programmers
  32. Clean Code: A Handbook of Agile Software Craftsmanship
  33. Solid Code
  34. Code Craft: The Practice of Writing Excellent Code
  35. Software Craftsmanship: The New Imperative
  36. Writing Solid Code

    Software Design


  37. Head First Design Patterns: A Brain-Friendly Guide
  38. Design Patterns: Elements of Reusable Object-Oriented Software
  39. Domain-Driven Design: Tackling Complexity in the Heart of Software
  40. Domain-Driven Design Distilled
  41. Design Patterns Explained: A New Perspective on Object-Oriented Design
  42. Design Patterns in C# - Even though this is specific to C# the pattern can be used in any OO language.
  43. Refactoring to Patterns

    Software Engineering Skill Sets


  44. Building Microservices: Designing Fine-Grained Systems
  45. Software Factories: Assembling Applications with Patterns, Models, Frameworks, and Tools
  46. NoEstimates: How To Measure Project Progress Without Estimating
  47. Object-Oriented Software Construction
  48. The Art of Software Testing
  49. Release It!: Design and Deploy Production-Ready Software
  50. Working Effectively with Legacy Code
  51. Test Driven Development: By Example

    Databases


  52. Database System Concepts
  53. Database Management Systems
  54. Foundation for Object / Relational Databases: The Third Manifesto
  55. Refactoring Databases: Evolutionary Database Design
  56. Data Access Patterns: Database Interactions in Object-Oriented Applications

    User Experience


  57. Don't Make Me Think: A Common Sense Approach to Web Usability
  58. The Design of Everyday Things
  59. Programming Collective Intelligence: Building Smart Web 2.0 Applications
  60. User Interface Design for Programmers
  61. GUI Bloopers 2.0: Common User Interface Design Don'ts and Dos

    Mentality


  62. The Productive Programmer
  63. Extreme Programming Explained: Embrace Change
  64. Coders at Work: Reflections on the Craft of Programming
  65. Facts and Fallacies of Software Engineering

    History


  66. Dreaming in Code: Two Dozen Programmers, Three Years, 4,732 Bugs, and One Quest for Transcendent Software
  67. New Turning Omnibus: 66 Excursions in Computer Science
  68. Hacker's Delight
  69. The Alchemist
  70. Masterminds of Programming: Conversations with the Creators of Major Programming Languages
  71. The Information: A History, A Theory, A Flood

    Specialist Skills


    In spite of the fact that many of these won't apply to your specific job I still recommend reading them for the insight, they'll give you into programming language and technology design.

  72. Peter Norton's Assembly Language Book for the IBM PC
  73. Expert C Programming: Deep C Secrets
  74. Enough Rope to Shoot Yourself in the Foot: Rules for C and C++ Programming
  75. The C++ Programming Language
  76. Effective C++: 55 Specific Ways to Improve Your Programs and Designs
  77. More Effective C++: 35 New Ways to Improve Your Programs and Designs
  78. More Effective C#: 50 Specific Ways to Improve Your C#
  79. CLR via C#
  80. Mr. Bunny's Big Cup o' Java
  81. Thinking in Java
  82. JUnit in Action
  83. Functional Programming in Scala
  84. The Art of Prolog: Advanced Programming Techniques
  85. The Craft of Prolog
  86. Programming Perl: Unmatched Power for Text Processing and Scripting
  87. Dive into Python 3
  88. why's (poignant) guide to Ruby
u/CodeBlueDev · 4 pointsr/learnprogramming

A lot of these are known as "Code Smells". Learn to identify them and try to fix them.

Other good books that may help you:

  • Refactoring
  • The Clean Coder

    Use something like StyleCop or Linting which are supposed to check and compare your code against best practices.
u/gtani · 4 pointsr/scala

What else is there? git history, hopefully clean w/consistent branch/merges and commit messages, server logs w/devop notes (esp. heap, maxInline, GC etc params) annotated stacktrace or profiler runs, breakpoints/debug strategy, db schema, net logs, design docs yadda yadda. Not knowing anything else, i would read thru repo's recent and early history, run unit tests, profile/load test it and see how failure prone the server(s) are

You could start with an old repo that has the basic functionality you're interested in, hopefully it's a lot less LoC.

You could read Fowler or Feathers which i remember being good: http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/

http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052/

u/pitiless · 3 pointsr/PHP

The following books would be good suggestions irrespective of the language you're developing in:

Patterns of Enterprise Application Architecture was certainly an eye-opener on first read-through, and remains a much-thumbed reference.

Domain-Driven Design is of a similar vein & quality.

Refactoring - another fantastic Martin Fowler book.

u/[deleted] · 3 pointsr/ruby

it's been out for almost ten years...different series, shares a lot of the same authors (fowler, beck).

http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/ref=sr_1_1?ie=UTF8&s=books&qid=1256190312&sr=8-1

u/throughactions · 3 pointsr/Python

Personally, I look for code smells. You can find them formalized in Refactoring: Improving the Design of Existing Code.

u/dohpaz42 · 3 pointsr/PHP

Agreed. There are plenty of resources out there that will help you understand design patterns. If you're new to the concept, I would recommend Head First: Design Patterns, it might be based on Java, but the examples are simple to understand and can mostly apply to PHP as well. When you feel like you've grasped the basic concepts of design patterns, you can move on to more advanced texts, like Martin Fowler's Patterns of Enterprise Design - this is a great reference for a lot of the more common patterns. There is also Refactoring: Improving the Design of Existing Code. These are great investments that will help you with any project you work on, and will help you if you decide to use a framework like Zend which uses design patterns very heavily.

u/materialdesigner · 3 pointsr/programming

Refactoring

read it. seriously. it's a great book. and it's invaluable.

u/threepipe · 3 pointsr/arduino

Lol I've never heard a script kiddie ask for factoring advice... guess there is a first time for everything. Maybe try reading this -- https://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/ref=sr_1_1?ie=UTF8&qid=1468244890&sr=8-1&keywords=refactoring.

u/d357r0y3r · 3 pointsr/programming

He hits on a lot of the same points in his book: http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/

Worth a read, certainly had an impact on how I approach refactoring and design in general.

u/UpAndDownArrows · 3 pointsr/learnprogramming

First time see that site, but I would recommend reading:

u/DEiE · 2 pointsr/learnprogramming

Break your main up into multiple smaller methods, and call those from your main method.

When doing this, the naming of the method is important. The name of the method should describe what the method does.

The cookSpaghetti is an example of this. The method name says what the method does, not how the method is doing it, which would be an unnecessary detail at that point.

When you structure your code like this, it will almost read like a story, which will make the code much clearer.

The Refactoring book provides more ways to improve the quality of your code, although it might be too advanced right now.

u/Iteria · 2 pointsr/cscareerquestions

If you're 4 years into your career and you haven't been failing at it and getting fired, you probably don't need to go all the way back to the absolute basics. You just need to fill in holes and keep pace with change.

I like to read books/blogs on emerging technology and areas becoming relevant. Like I just read [Refactoring: Improving the Design of Existing Code] (http://www.amazon.com/gp/product/0201485672) because we were doing a huge refactoring project at my job. I read Ng-book and an .NET MVC right when I got my current job because I'd never worked with angular or MVC before. I'm currently looking at some stuff about .NET Core. It won't be relevant at most places for years, but it's nice to keep on the edge sometimes.

Blogs are also good things to read too. The Morning Brew is my favorite site right now for keeping up with .NET.

If you're worried about your fundamental skills I'd say work through something like codility. I think you'll find a lot of the problems trivial or easy to pick up and do with a little googling. Sites like this are usually the kind of questions you'll get asked in interviews, so if you can do them, then you're fine on that front.

u/homeless_dude · 2 pointsr/learnprogramming

Yours is better. You eliminated the temporary variable which is a very good refactor. Performance wise yours is better (for same reason) unless the compiler optimizes away the temp variable, then they are the same.

For some reason code that uses temporary variable like theirs takes me longer to read.

I will recommend the book refactoring by Martin Fowler.

u/ickysticky · 2 pointsr/AskProgramming

Refactoring: Improving the Design of Existing Code is ok. I don't know if it is as amazing as the reviews think, but it is pretty good. It is a little Java centric.

You really don't see many blog posts/internet articles about refactoring. It almost sounds like you are looking for help with design, refactoring is just the process of how to reach a better design.

The most important part is to write unit tests to make sure that you preserve the required behavior during refactoring.

u/gilesgoatboy · 2 pointsr/programming

strictly speaking, it depends on the language, but probably you don't understand objects. given that you're in Python and it's got OO (or close enough), I'm going to escalate that from a probably to a very very probably. basically, if you move the stuff inside the ifs into methods on objects, in the absolute simplest case, you'll put each if inside a different object, and then your huge chain of ifs turns into:

object.method(arguments)

And instead of throwing all those ifs in there, you basically run through all the ifs ahead of time by just giving that block of code an object of the appropriate class.

The absolute best book on OO (in my opinion) is Refactoring.

http://www.amazon.com/gp/product/0201485672?ie=UTF8&tag=gilebowk-20&linkCode=xm2&camp=1789&creativeASIN=0201485672

I have a feeling the Head First book on OO is also very, very good. I haven't checked it but the series is a great series.

u/MorrisonLevi · 2 pointsr/PHP

As others have mentioned you need tests.

If you can't write tests at all because the way the code is put together then the first step is to untangle things. This can be hard. If your code is working I'd probably just leave it alone until you need to touch the code for some other reason (adding a new feature, usually).

I recommend this excellent book for learning about specific ways to refactor, as well as when they are commonly used: http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672

u/emcoffey3 · 2 pointsr/IWantToLearn

Objects are for grouping related data and methods together. It really is as simple as that.

Start off by writing applications where you're just creating and consuming objects, not writing your own classes. Java and .NET both have tons of libraries that contain a wide assortment of objects. You mentioned C#, so write a few .NET apps. Try to start identifying and understanding the way properties and methods are grouped into objects, and how the different objects relate to each other.

Once you're comfortable using objects, then you can start writing your own classes. A lot of universities try to teach this by having you write common data structures. This approach is worth considering, as it's important to be familiar with data structures, but this isn't the only way to learn object-oriented programming (nor the best, in my opinion). Another commenter recommended writing a video game, which sounds like it's worth a try. Ultimately, the right approach is the one that interests you the most.

Getting good at OOP will take some practice, but it is possible. Objects are like functions: they should do one thing well. Enforce separation of concerns. Learn the design patterns. Practice makes perfect(-ish).

Recommended Reading:

u/phuber · 2 pointsr/dotnet

If you are open to it, here are a few good reads to help you on your way. The legacy code book may pay dividends quicker given your situation.

Clean Code: https://www.amazon.com/dp/0132350882/ref=cm_sw_r_cp_apa_ruhyybGGV0C34

Refactoring: Improving the Design of Existing Code https://www.amazon.com/dp/0201485672/ref=cm_sw_r_cp_apa_gwhyyb1VRNSKK

Working Effectively with Legacy Code https://www.amazon.com/dp/0131177052/ref=cm_sw_r_cp_apa_0whyyb3Y604NJ

Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation (Addison-Wesley Signature Series (Fowler)) https://www.amazon.com/dp/0321601912/ref=cm_sw_r_cp_apa_JxhyybA08ZQF8

u/bigmikemk · 2 pointsr/learnprogramming

What you do is called refactoring and it is a good thing to do as long as you don't do it instead of planning ahead. But often time you can't plan out every little detail and then it's the right thing to do some cleaning once you have a working implementation.

Martin Fowler wrote a whole book about the topic (which is very good btw): http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672

u/vinnyvicious · 2 pointsr/gamedev

Have you ever heard of the open/closed principle? Or the single responsibility principle? Or Liskov substitution principle? All three are being violated. It drastically reduces the maintainability and extensibility of your code. I can't swap serializers easily, i can't tweak or extend them without touching that huge class and it's definitely not the responsibility of that class to know how to serialize A, B, C, D, E and the whole alphabet.

I highly recommend some literature on the subject if you're curious about it, it would drastically improve your approach to software architecture:

https://www.amazon.com/dp/0132350882

https://www.amazon.com/dp/0201485672

https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215

http://cc2e.com/

https://www.amazon.com/dp/0321127420

u/binarybabe · 2 pointsr/TwoXChromosomes

I've found that I gained most of my best experience on the job, and that staying at a job where I wasn't learning anything was a huge mistake and detriment to my career.

That said... I don't think I'm a super genius either. I did well in college and my GPA helped with my first few jobs. But I have lots of hobbies outside of work, and rarely spend my time at home thinking about the office. A lot of times companies aren't looking for the super genius type either... if they were they'd have a hard time filling staffing requirements. I think the keys are learning how to interview well, focusing on letting the interviewer know that you're willing and good at learning and having the basics of OOO down to a T. Come off as confident, even if you don't feel it. It never hurts.

As far as books go, here are some of my favorites:


Programming Interviews Exposed


Programming Pearls


Refactoring



I'm mostly a java programmer, so here are three absolutely necessary java books:


Head First Design Patterns


Core Java 1


Core Java 2 - Advanced


u/teresko · 2 pointsr/PHP

You should start slowly refactor the whole codebase. There is no other way. This will not only make you "combing through each line of code by hand" but also require you to understand what was written it.

The alternative is letting the application slowly fade into obscurity.

This might help a bit : Refactoring: Improving the Design of Existing Code

u/Pet_Ant · 2 pointsr/programming

Clean Code
Refactoring into Patterns
Both talk a lot about them but do not enumerate them authoratatively.

u/guifroes · 2 pointsr/learnprogramming

Interesting!

Looks to me that you can "feel" what good code looks like but you're not able to rationalise it enough for you to write it on your own.

Couple of suggestions:

When you see elegant code, ask yourself: why is it elegant? Is it because is simple? Easy to understand? Try to recognise the desired attributes so you can try to reproduce on your code.

Try to write really short classes/methods that have only one responsibility. For more about this, search for Single Responsibility Principle.

How familiar are you with unit testing and TDD? It should help you a lot to write better designed code.

Some other resources:

u/last_useful_man · 2 pointsr/learnprogramming

I have to say linux profiling has seemed to me to be a fast-moving target, meaning you'll get scattered results if you search. But, there's this which seems up-to-date: http://en.wikipedia.org/wiki/Perf_%28Linux%29

Then there's Ulrich Drepper's 'What every programmer should know about memory' (long series, but worth skimming at least, if your code is memory intensive. At least read about cache-coherency and cache-lines): http://lwn.net/Articles/250967

But the biggest thing is to get the algorithms right. Sounds like you want image-processing books. Also, GPUs are just absolutely the right place to do this stuff, and there are probably libraries already out there for it; speaking of which, did you know about OpenCV? It even has some stuff implemented on the GPU (as CUDA). I root for OpenCL, but the fact is, almost everything out there, libraries, and books, is written for CUDA.

> All the software is written in C++: I am interested in unlearning bad habits and writing better and easier to maintain code.

I suggest Effective C++ if you haven't read it yet. Also, Herb Sutter's 'Exceptional C++' series (a 'digest' version is C++ Coding Standards: 101 Rules, Guidelines, and Best Practices).

Never read it myself, but I hear 'Code Complete' is good. Maybe, too, Martin Fowler's Refactoring book - it shows lots of little awkward, problematic patterns and what to do about them, with good discussion. Each cleanly separated out - it will refer back and forth, but you can read the bits one-at-a-time. Good bathroom reading :)

Re: algorithms: Ugh, I don't know. It sounds like you'll want some metric data structures, dealing with space as you do. There's http://www.amazon.com/Foundations-Multidimensional-Structures-Kaufmann-Computer/dp/0123694469, and I don't know what else, maybe some Knuth? But probably, you should learn undergraduate-level data structures and algorithms, Big O stuff. Any used CS Data Structures + Algorithms book should help with that.

Do not fear spending money, as a former boss said, "books are free" ie they pay for themselves if they save you an hour's debugging later. Good luck!

u/negative_epsilon · 2 pointsr/learnprogramming

At first, just code. Your code will suck, but it's okay because you're learning.

Then, once you have a good grasp of programming, read

http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672

And

http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?s=books&ie=UTF8&qid=1397498858&sr=1-1&keywords=clean+code

You can probably find them for free online.

u/instilledbee · 2 pointsr/compsci

Data Structures and Algorithms in C++ by Adam Drozdek - Pretty much helped me survive my Data Structures class

[Refactoring: Improving the Design of Existing Code by Martin Fowler]
(http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672) - Serves as my go-to book at work, right next to Design Patterns.

u/ensiferous · 1 pointr/PHP

I can't exactly give a better alternative because on how you refactor code as it is highly variable. There are written multiple books about it^1 which span thousands of pages.

^1 Such as Clean Code and Refactoring

u/grumbel · 1 pointr/learnprogramming

I would suggest a look at Refactoring - Improving the Design of Existing Code, using Python's unittest library and have a look at how to write Python modules. This talk about dependency injection is also worth a look.

The book won't directly teach you how to write "complex software", but it will help you understand how to untangle whatever spaghetti code you have produced so far. Furthermore using Unittests forces you to write code in such a way that it's reusable, which again forces you to think about how to un'spaghettify it.

u/Eclipse1agg · 1 pointr/incremental_games

> future proof'd myself so I don't end up in situations where I'd have to rewrite basic stuff to get new features in later.

I recommend you Refactoring, improving the quality of existing code. It helped me to get past overengineering code and embrace working code now, even if I need to rewrite later.

u/VikingCoder · 1 pointr/gamedev

I think others have said what needed to be said, but I'll throw out one more piece of advice:

Get a teddy bear.

No, wait - hear me out!

A lot of people advocate code reviews with other developers, to keep themselves honest. When you're about done adding a feature to your project, you should review the code with another developer. After going through this a few times, many developers learn to clean their code a bit, before letting another developer see it. How you solve it, isn't how you should leave it.

Well, it turns out that this mental act of getting ready for a code review is where you get a lot of the benefit of code reviews. Meaning, for a lot of the value of code reviews, you don't even need the expense of a code review! Just the act of preparing for one, makes your code better.

So, I've heard of getting a code review teddy bear.

When you think you're about done, adding some new feature to your code, get ready to code review it with your teddy bear.

And then you have to explain all of your changes and new code to the teddy bear, aloud. Use English, and tell it what each line of code does.

And then don't add comments to explain the tricky bits! Rewrite your code so that the tricky bits are readable. And if you can't rewrite it so that it's readable, then encapsulate those tricky bits inside methods with simple names, simple parameters, and no access to global variables.

GOOD LUCK, AND KEEP TO IT! It'll make you a better software professional in your main career! Tinkering is good! Don't get frustrated!

Maybe try reading "Refactoring"

http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672

Just to get the mental wheels turning.

And maybe try: "Working Effectively With Legacy Code" to inspire yourself...

u/devnull5475 · 1 pointr/programming

This is a good read: Working Effectively with Legacy Code

Basically,

  • Get unit tests in place
  • Get instumentation in place
  • Start refactoring

    P.S. I assume you have already studied Refactoring by Martin Fowler.
u/zahlman · 1 pointr/learnpython

> Python with Github? Of course I can google plenty of guides, but the fact that I read many of them and still don't use it, shows me that I don't think the guides were good or sufficient (or I just suck at google). To me (for now) it feels like a big hassle with the commits, etc. for a very small profit (despite the sharing with other people). Is there a good and concise resource that you'd recommend?

Is it really GitHub you need help wrapping your head around, or is it git itself that causes the problem?

>101 of bad habits/beginner mistakes link/resource? I've seen plenty of links now that say "don't import *!" or similar stuff. But never a real compilation. Can also be about habits of programming or little shortcuts or tricks and tips, not only common mistakes people new to Python make. I know I'm asking for a lot but it might help and turn out to be very useful.

Well, there's the Zen of Python, which you can see for yourself at the REPL using import this. But for more concrete advice... if I found a compilation like that, I don't know that I'd trust it. A lot of these things are subjective. And anyway, if you're expecting to be able to read through something like that and magically get rid of bad habits, I can tell you it just doesn't work that way. You need to practice, and you also need to focus on the positives rather than negatives. Get used to the techniques by which code is improved. If you like physical books for this sort of thing (I don't), the best I can recommend is this one - you might be able to find online versions, but as far as legality goes, you're on your own to figure that out.

u/codahale · 1 pointr/programming

I think you're confusing poorly factored code with a holistic piece. You can always find a way to split up a long method into smaller, more meaningful pieces -- you may end up with more lines of code, but it's about how easily the code is understood, not the disk space it takes to store the code.

It's not a simple choice between "stuff it all in a class" and "stuff it all in a function." Refactoring has a huge list of ways of cleaning up existing code -- I'd suggest getting a copy and reading it.

u/boshlol · 1 pointr/django

Working Effectively with Legacy Code is an excellent book, I would also recommend Refactoring: Improving the Design of Existing Code

u/xnoise · 1 pointr/PHP

There are a ton of books, but i guess the main question is: what are you interested in? Concepts or examples? Because many strong conceptual books are using examples from java, c++ and other languages, very few of them use php as example. If you have the ability to comprehend other languages, then:

http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612/ref=sr_1_1?ie=UTF8&qid=1322476598&sr=8-1 definetly a must read. Beware not to memorize it, it is more like a dictionary. It should be pretty easy to read, a little harder to comprehend and you need to work with the patterns presented in that book.

http://www.amazon.com/PHP-5-Objects-Patterns-Practice/dp/1590593804 - has already been mentioned, is related directly to the above mentioned one, so should be easier to grasp.

http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420/ref=sr_1_1?ie=UTF8&qid=1322476712&sr=8-1 - one of the most amazing books i have read some time ago. Needs alot of time and good prior knowledge.

http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/ref=sr_1_4?ie=UTF8&qid=1322476712&sr=8-4 - another interesting read, unfortunatelly i cannot give details because i haven't had the time to read it all.

u/ABC_AlwaysBeCoding · 1 pointr/ProgrammerHumor

If I could make a recommendation based on time-tested experience, I'd recommend following the advice of 2 books, Refactoring: Improving The Design Of Existing Code and Growing Object-Oriented Software, Guided By Tests.

Basically, if you are committed to this codebase, you can rewrite bits and pieces of it (while covering them with tests to make sure you didn't break any functionality) and slowly migrate/transform the code to a point where it's more maintainable.

Of course, if you have a manager who you can't convince this is worth spending time on, you might point them to a resource like this about technical debt or perhaps this one to bring it down to dollars and cents (which every manager understands).

I'd also recommend reading this great piece by John Carmack (of id's DOOM fame, and now VR... He's a highly respected OO C programmer, I'm sure you've probably heard of him) about his excursion into 1 month of programming using a "functional style" (it's applicable to any language, actually, including PHP). It has great quotes like this one: "No matter what language you work in, programming in a functional style provides benefits. You should do it whenever it is convenient, and you should think hard about the decision when it isn't convenient."

I promise you that if you can follow some or all of the knowledge I've linked you to, your job will become both less frustrating and more enjoyable (down the line).

u/rocketsocks · 1 pointr/askscience

Code every day. Work on as many little interesting projects as you can. If you don't know any languages I'd suggest starting with Python, there are a million different tutorials and resources online, so getting started shouldn't be a problem.

Add to that, read some books to learn about how software development projects work, different techniques, best practices, pitfalls, etc. Here are my recommendations on books: The Pragmatic Programmer, Refactoring, Code Complete (a bit dated, but still solid), Rapid Development (slightly mis-titled, it's a good overview of different development practices), The Architecture of Open Source Applications, and Design Patterns. Code as much as you can, be ambitious, be analytical and introspective about the problems you run into, and read and understand those books too. There's a lot more you'll need to learn to become a good developer, but what I've described will give you a very strong base to build on.

Oh, and if you don't already know discrete mathematics you'll need to pick that up. I'd recommend this book.

u/div · 0 pointsr/programming

If this reminds anyone else of the very first example in this book , then the previous blog entry might shed some light:

> A few of my colleagues and I have decided to write, with Martin's permission, a Ruby version of Refactoring. To begin with this will be a port of the existing Refactoring text. After we finish the port, we are going to look at Ruby specific refactorings. As I go through porting the text I'm going to post what I work on to my blog.

edit: I'll probably read other people's comments before posting next time ;p

u/Mathestuss · 0 pointsr/csharp

I think the two best things any developer can learn are:

  1. the SOLID principles described in Robert C. Martins books "Agile Software Development"/"Clean code"
  2. the Gang of Four Design Patterns

    These principles can be applied to any object oriented language. Learn them well enough that you can explain to someone else what they are and when to apply them.

    ​

    Other areas of knowledge that can be applied broadly are

  3. Source Control
  4. Dependency Injection
  5. TDD
  6. Code smells (There is an expanded list in Marin Fowler's Refactoring book)
  7. Algorithmic Complexity


    After these things you are probably going to need an area of focus to drill down on.


    Also, if you can't already, learn to touch type. I always wish I could type faster.
u/mariox19 · 0 pointsr/programming

Minus 6?! I'll write the author.

u/StoneCypher · -2 pointsr/javascript

Everyone here is going to give you a bunch of 30-days or head-first books - many of which will have the ostensible impremateur of big names like Crockford and Resig.

Let me be the first to tell you to basically ignore this crap.

Read the standard, get a good reference on browser differences, then focus on real programming books that are not language specific. That's the way to rise above making jQuery plugins and "HTML5 Game Demos" of Atari 2600 games.

The standard:

http://www.ecma-international.org/publications/standards/Ecma-262.htm

Good reference on browser differences:

http://www.quirksmode.org/compatibility.html

The kinds of books you should be reading (notice the used prices please):

http://www.amazon.com/Introduction-Algorithms-CD-Rom-Thomas-Cormen/dp/0072970545/ref=sr_1_1?ie=UTF8&qid=1313160060&sr=8-1

http://www.amazon.com/Computer-Programming-Volumes-1-4A-Boxed/dp/0321751043/ref=sr_1_1?ie=UTF8&qid=1313160086&sr=8-1

http://www.amazon.com/Structure-Interpretation-Computer-Programs-Second/dp/0070004846/ref=sr_1_1?ie=UTF8&qid=1313160117&sr=8-1

http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612/ref=sr_1_1?ie=UTF8&qid=1313160130&sr=8-1

http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/ref=sr_1_1?ie=UTF8&qid=1313160138&sr=8-1

I'd throw in a rickroll if I could.

A deep knowledge of CSS will help. If Javascript is your hammer, CSS is your screwdriver; the two are very related in most cases (sure there are exceptions, like node servers, but they're not common.)

Like JS, the best way to learn CSS is the standard.

http://www.w3.org/TR/CSS21/

Happy hunting.