Planning Your Problem Solving Think Like a Programmer


hello the Anton sprawl here again with another video about how you can learn to think like a programmer in this video we’re going to talk about plants how you can plan your way from a problem description to a problem solution I’ve been meaning to make this video for quite a while but I’ve been struggling with it because ultimately getting to the stage where you can confidently plan a solution to a new problem is the culmination of my whole book so I can’t get you to that point with one simple video however this topic is important to discuss because I think it goes to the heart of what problem solving is all about and what it’s not about and understanding that distinction will really help learning programming be a rewarding experience and not so much a frustrating one one of the things I say in my book over and over again is that you always need to have a plan but what is a plan in the context of problem solving here I’m going to make an analogy with football and by that I mean American football and if you’re not very interested or knowledgeable about American football don’t worry that should still make sense football teams have playbooks a play and football draws up where different players should be standing on the field and where they should go after the ball is snapped which players on the opposing side they should be looking at how they should react to the moves of the opposition during the play and so on a particular teams playbook represents the things that team does well on offense whether that’s power running or Daddy passing game or whatever now when it comes time to actually play the game no team simply runs the plays in the PlayBook in order based on the particular defense the team is facing the coaches will expect certain plays to be more effective than others early in the game those are the plays that will get called and then based on the outcomes of those plays they’ll either keep calling those plays or they’ll have to switch to something else that in a nutshell is what planning is like for problem solving the problem solving techniques that you know are your playbook based on your particular way of looking at things some of those techniques may be your favorites the equivalent of a go to play in football when you are applying your playbook to a particular problem certain techniques may initially seem more applicable than others so these are the ideas that you try first but if your initial ideas all run into brick walls then you have to go deeper into your playbook and try some things that you don’t normally try it’s important I think to understand this concept of planning I see so many early programmers who are under the misconception that planning towards a solution is something like following a blueprint where everything has been spelled out in advance and all you have to do is carefully follow these instructions to guarantee success but problem solving is not like following a blueprint now something like a blueprint does come up in programming and that’s a formal design document but that comes up after we already know how to solve the problems in the program then we can create design documentation to be shared among members of a programming team so that everybody is working towards the same goal like a blueprint design documents do sometimes get modified during the actual build as unforeseen problems arise or as certain things turned out to be more complicated than they first appeared but the point is blueprints and design Docs are not plans for solving problems they are records of the solutions that were found in these videos I talked about a number of approaches to solving problems such as temporarily reducing the scope of problems or a recursion or using a spreadsheet as an analysis tool in the book I talked about many more and I’m sure there are plenty that I haven’t even thought of how and when you will try these approaches on a problem forms your plan no one can really give you that plan because it’s individual as a fingerprint you’ll discover your plan as part of your development as a programmer if you enjoy programming and stick with it I promise you the plan will come the programmers who have come before you are all following methodical plans is just that the best and most experienced programmers have internalized their plans so deeply that it comes across to the rest of us as intuition if you’re a learning programmer here’s what I would suggest as a next step take a problem that you don’t yet know how to solve either an exercise from a book contest problem or however you find it read the problem carefully and set aside some time just think up approaches for solving the problem come up with as many as you can almost every problem can be broken down in some way into parts for example and because you can start with any part that gives you multiple ways to start right there or you can try reducing or restricting the problem to make it much easier to begin again there are many ways to make a problem easier so think up more than one way maybe recursion should work or maybe this is a case from my spreadsheet approach point is think the idea is up and write them down keep going until you can’t think of any more then look over your list and make a guess about which ones you think you should try first maybe because the ideas look the most promising the quickest way to a solution may be because the idea focuses on the easiest part of the problem and you want to start there or maybe because it starts at the hardest place you have to decide what appeals to you and there’s no one right order for the list but now you have a plan and that’s the key now you can sit down at the computer with your route mapped out if the first thing on your list proves to be a complete dead end just cross it out and move on that still counts as progress to circle back to my football metaphor many football games begin with a run up the middle that the defense stuffs for a loss that’s fine now the coach can try something else solving a programming problem is like a game that you can’t lose unless you quit follow your plan and to develop as a problem solver keep finding new solving methods new tools for your toolkit new plays for your PlayBook as always I hope this helps you develop your problem-solving abilities and learn to think like a programmer if you have ideas for future videos feel free to send them my way or post them in the comments and please do subscribe share and or hit that like button if this video was helpful to you thanks

Leave a Reply

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