   How do you keep focused on your code?
  As of late, I've been finding it increasingly harder and harder to focus on writing source code.  Not only do I get tempted to play games and watch movies online, but sometimes I feel completely brain dead and just stare at the code, maybe daydream and start to slack off.  Even worse there are multiple other distractions to deal with such as other people in the household.  It would be nice to get out more, but when you've got less than $30 USD in your bank account atm, going out isn't exactly a luxury I have at my disposal.  Even if I do go out, there's too much stuff to play with on my laptop since it's currently my only means of having a PC right now until I get my desktop back so I have to do everything on this thing when I originally bought it to do work and programming stuff.  If I had nothing but coding related stuff on this laptop, I'd be good, but unfortunately, that's not the case.What's you're recommendation?  Thanks.   
  Set milestones (small goals).To keep your brain working exercise regularly and eat/sleep well.   ;  Why is it a problem? Do you make a living with coding?If not, then probably you don't have the mood for coding. Why is it a problem?I mean, er... Why is it a problem?BTW I keep focusing on the code with glasses.   ;Quote:Original post by blueshogun96As of late, I've been finding it increasingly harder and harder to focus on writing source code.  Not only do I get tempted to play games and watch movies online, but sometimes I feel completely brain dead and just stare at the code, maybe daydream and start to slack off.  What's you're recommendation?  Thanks.You sound just like me,Generally I go through cycles, one week of production, one week of being totally sick(generally when I hit a bug that requires work to fix). I'll be watching this topic with interest :D   ;  I find it most effective to work on stuff I'm interested in.  I can stay up until 3AM coding UI improvements for LucidChart (sig), but I can't stay focused on a school assignment for a half hour.  If you're not doing this for a living, you can afford to switch your focus to coding something you're interested in.   ;Quote:Original post by BeanDogI find it most effective to work on stuff I'm interested in.  I can stay up until 3AM coding [...] but I can't stay focused on a school assignment for a half hour. [...]Ironically it's 2:45 AM atm and I have a homework assignment and all I can focus on is this WebGL project I started.I tend to switch projects easily going to work on things that interest me or that I find challenging. Not sure if you're like that. Also about playing games, it's probably different for everyone. I just play them, win, then move on. Takes a few hours or a few days to beat most games so I just treat them as small breaks between coding.Can't help you with the TV thing though. I don't have cable normally, but since I do in my dorm it sucks away my attention to the point where I just program between commercials most of the time.   ;  What is your motivation?Not what you want from your game, but what you want out of LIFE.It sounds like you are using entertainment as a means to avoid something you are not motivated to do.Once you really know what you want, you will generally discover that actions toward your life's purpose are satisfying and you will be intrinsically motivated to do them.When you don't find pleasure in the things you think you want to do, it is time to re-evaluate what you really want out of life.Do some serious soul-searching.  I recommend the flower diagram in the appendix of "What Color Is Your Parachute", although it more focused toward your career.  Get in touch with yourself, identify where you truly want to go, and you will be on your way to your personal bliss where you love what you are doing and will do the hard stuff because you know deep-down that you want to.   ;  I follow a basic execution process called the OODA Loop. Extreme Programming, SCRUM, whatever-we're-calling-the-process-today, are all just different tools (stand-up meetings, TDD, pair programming, etc) plugged into this model.I use it at home and I impose it on my team at work (they don't specifically know this is what I'm doing, but neither is it important or necessary that they know, they just do what I say and it happens). There is no one starting point for all of this, there are multiple sub-processes that occur in parallel and overlap each other. The major driving process is the largest iteration loop -- once every two weeks we set milestones for releases. Usually this is costumer-driven, either from discussing needs with the sales managers or reviewing demos with us, but sometimes I set them based on what I know needs to be done just to make the project work.Once a day, I enumerate our tasks, based on our milestones. It works out to be a typical stand-up meeting. I set priority for the tasks, then delegate the tasks to my teammates and myself appropriately to keep us all busy and to ensure the highest priority tasks get done first. If we run out of tasks... wait, that's never happened. These tasks are anything that needs to be done, from making policy decisions on security protocols to specific defects in the bug tracker to scheduling time to test the project.Multiple times per day, we complete tasks and remove them from the task list. We keep each other informed on what tasks are completed when they are completed. Even though tasks are assigned, the task board is open, so if someone runs out of tasks, they go to the board to find more on their own. Sometimes, if certain tasks get done earlier than expected, or are taking longer than expected, I will reshuffle the priorities and assignments to account for the change.We perform testing and have demos and discussions with the client to see where we are with regards to meeting their needs. This often changes over time, either because the client didn't know what they initially wanted, or because they changed their mind. It doesn't matter, we change direction as quickly as possible. Never dwell on what those changes mean. You never know from the start what the project will turn into. It's better to change quickly and early when you get more and better information than to worry about how wide sweeping the changes are. The fact that change is destructive is beside the point, what you worked on yesterday has no bearing on today, you should only care about getting the project done.I say this because humans in general have a problem with getting fixated on sunk costs. Say you go to a movie, pay $8.00 to get in, and find out in the first 10 minutes that the movie sucks. What do you do? Do you stay because you already spent the money and you'd be "wasting it" if you left? Or do you leave because that money is gone no matter what you do and nothing good will come out of watching a crappy movie? The best decision is to leave before the crappy movie sucks away more of your life, but most people don't do that because people give too much credence to the past.The point of how this applies to programming, especially with personal projects, is that you will get to a point where you realize that you made a fundamental design mistake early in your project that is preventing you from progressing. You will be tempted to work around the mistake because it would be a "waste" to throw away all of the code you wrote. But it's not a waste, you've already spent that time, and the design flaw is still there. Eventually, you'll start to find excuses not to work on the project because you dread approaching the design flaw. The longer you live with a design flaw, the more it costs you.All that matters is the end result of the project. Code boldly. Do not be afraid to make mistakes. I see a lot of beginner programmers dead-lock on coding because they can't figure out "the right way" to do something. Nobody knows the right way. We have ways that have worked for us and we know that other ways won't work at all, but nobody has a definitive "right way" to do things. You *will* make mistakes, so it's better to reach those mistakes quickly, learn from them, and move on.Observe what needs to be done, Orient yourself to the path of completing those tasks, Decide on what to do and when to do it, and Act on those decisions. Iterate and recurse this process.   