I find when im writing code I often get distracted by games and youtube, and id like to know what strategies/tactics you guys use to stay focused on a project.
Keeping in mind I never finished any of the projects I have started, I kinda want to know the solution as wellâŚ
I usually find that working til I accomplish something or meeting a goal often works best. Not taking a break until that goal is accomplished. The skill lies in choosing goals that can be accomplished in a reasonable amount of time while not being too easy.
I know there is a program out there thatâll restrict distracting things like youtube, games, etc. cant remember the name of it.
Also Coffee + L-Theanine helps
i find that segmenting my PC into gaming/slacking, and actual work helps.
At home i have 2 stationary pcâs.
One running window$ for gaming with hardware for that need, and the other running older hardware, running linux, just for work.
Before i bought my gaming PC i used a VM to segment my work âPCâ, so that when ever my VM was running, basically that was
bussiness.
And if i shut it down and returned to my window$ desktop all the gaming, and facebook tomâfoolery was ok.
Basically if your PC isnât setup to constantly spam you with noiseâŚwell there is no noise, and you can get some work done.
dont install steam on your work PC, i guess listening to youtube music is ok(We all need to be in the zone), ignore FB(just dont use facebook really),.
have some self discipline, but help it along with not working on your âgaming/desktop/dailyâ pc.
Most the problems you are explaining are by webpages etc. which are specifically designed to keep you trapped, and as a developer,
thatâs not really where you wanna be.
You design your own environment, and therefor also which distractions are in it.
By now i got it down to that when at work i just check linkedin, and a news paper when ever i have run out of ideas and need to abstract abit from a problem.
Else i go grab a smoke, and usually a 5 min smoke break can solve a problem which usually takes hours of blindly flailing, so distractions can be good
at times.
I like @trexd answer, blocking websites just fights the symptoms but the reason often lies somewhere else.
I can stare at a wall for one hour straight, if I donât like my current programming task. So you have to change it in your mind, make it smaller maybe. Iâm still bad at this.
It helps to write down what you want to accomplish before starting and set a definite end time. For me I finish class at 2:50 pm and work until 5:00 pm at the library. During this time period I try to accomplish a small task that will aid me later on. Today I plan on making a small for-loop to scan through two ArrayLists (for the intention of multiplying later on).
I end up leaving school feeling proud and excited to tackle the next task when I get home. It takes me about 15 minutes to walk home, in which I think about how Iâm going to implement that small thing I made into the bigger picture. When I get home I make sure to grab a quick bite to eat (no more than 10 minutes and without looking at my phone) and then I begin to code. I work for another couple of hours until dinner (and if Iâm making good headway, Iâll continue working through dinner) after which Iâll work on my program until midnight while still trying to reach a goal or have my program accomplish something. After midnight hits I can be satisfied that I accomplished at least something without feeling guilty of being distracted. If you give into temptation, youâll just end up hating yourself, with the vicious cycle of never feeling a sense of pride or accomplishment. Make small goals and work hard to reach them.
Acknowledge that even if you got absolutely nothing done that day, you worked hard without giving into temptation. I live for this satisfaction but it can be difficult to get into this mindset but know that it can be done with persistence.
Coffee, music - and a drawing / post-it scripted plan on what teh h*ck I am supposed to do.
But yes. Usually I end up doing the sameâŚ
As of others have said set small goals to accomplish everyday or whatever time schedule works for you. Our minds are actually better at completing a larger project in small tasks rather than trying to knock the entire scope in a long sitting.
I use the separate machines method and also kanbanflow to manage what I need to work on. It also has a useful timer (well, it is when you discipline yourself to use it).
The biggest problem I sometimes have is that many people seem to work in âmanager timeâ not âengineer timeâ. Manager time is when you day is broken down into 30 minute or 1 hour slots and engineer time is when it is broken down into half day or day slots. Manager time is for people who go from one meeting to the next and then have to just write up a few notes or update a project plan. Engineer time is for people who need to really settle into their work so they can get on and design or build something. Managers, working in âmanagerâ time donât get this and will constantly interrupt engineers asking them to join yet another meeting or call, and then ask why progress is slow
Back in my Chrome days I quickly threw together an extension to block websites, because I noticed I was clicking on twitter and YT when I didnât even wanted to, it was a habit.
Since then I moved to firefox, and deleted twitter, 80% of my YT subs and 90% of my reddit subs, that kinda helped.
As for when youâre actually coding, what really helps is a list of things to do. I add // TODO
s and // FIXME
s in my code and grep
and awk
them atm to see what I need to be working on. As well as have a simple TODO list on my desktop for more higher level stuff.
The trick seems to me to be just starting working, after that you donât even want to stop, unless distracted by something (notifications, people, etc) or when you finish a feature and you distract/reward yourself with some web surfing. BTW this is why I donât allow notifications from most web sites.
OFC, itâs easier said than done. Especially when youâre working on something you donât wanna be working on.
To add to the // TODO
s and shit. The reason I keep it in the code base rather than in some Trello board or whatever is to keep it close to the code. Code changes, and so does all the TODOs, FIXMEs and NOTEs, itâs easier to manage them like that, when they are near each other. You donât need to sync your board/list with the code base. But higher level stuff can easily go into those, obviously.
Another good thing from that, IMO, is that VCS tracks that too, so if you roll back to previous version, or different feature branch, the TODOs and FIXMEs represent that local state.
Example of my little python script that groups output from grep
:
Thanks for the help guys
Music works like a charm for me.
Its feel has to compatible with my mood, and (in most cases) crucially:
It must not have lyrics!
Most âfocusâ or âstudyâ playlists on Spotify are decent all-round playlists. SoundCloud have some suitable playlists to, but Iâd skim over the tracks to avoid anything that might adversely affect ones state of mind.
While in extreme moods, I might skimp on the âno lyricsâ rule and prioritize qualities that either emotionally harmonize with, or influences my current emotions. Former to avoid cognitive dissonance. And latter to attain some desired mental state. This may include basically everything.
Hereâs a bit of what I normally use to focus:
- Random âFocusâ or âStudyâ playlists
- Random instrumental playlists
And some stuff I can remember having listened to when moody:
- Any pre-âSt. Angerâ Metallica
- My Little Pony (sometimes OST, other times mixes/influenced originals)
- Anything Disney
- Random collection of either heavy or death metal
- '90s pop
- etc.
No music is too stupid or bad if it works for you!
Though you might want to consider headphones to minimize judgmental stares
The best way to focus SQUIRREL!!!
Well, Iâm not the guy to ask probably but I second the idea of music.
Specifically film scores are often perfect because they are almost purpose built.
Limitless and K-PAX have something that just works for me.
Close all browsers. Close Steam (actually quit the program), so your notifications about your friends donât come up. Enter full screen or focus mode if your editor or IDE has that. Put on some quiet music, usually without lyrics.
That works for me. I generally go for a walk or something to clear my head of racing thoughts. It helps to visualize your objective or goal for the day too. You might get distracted at first, but if you practice youâll get better at it. A lot of people refer to this as mindful mediation.
The irony of me reading this thread while at workâŚ
I canât help myself.
after you get experience its not that hard to keep from getting distracted, however you have to be working on a project you like. the right music helps ALOT to be truly âplugged inâ. If you are working on something you enjoy, you wont even want to game at that moment
OP it is just basically called having discipline. Prioritize work over other things but keeping a healthy balance.
Sleep well, eat right, hydrate, and limit the caffeine to reasonable levelsâŚ
I second what others have said above. It is hard for anyone to focus on something they donât want to do. I like to listen to music while I work to drown out distractions.
My biggest weakness. When I actually sleep normal amount of hours (it goes for both under- and oversleeping) and it the proper timeframe it indeed helps a lot!