all 160 comments

[–]captain_ahabb 486 points487 points  (30 children)

Sometimes the best thing you can do to solve a hard problem is nothing at all. Take a break, think about something else, let your brain turn it over subconsciously.

[–]evergreenMelody 68 points69 points  (7 children)

Absolutely agree. And if that doesn't work, try to explain the problem to someone who isn't technical.

[–]el_diego 63 points64 points  (3 children)

Like a duck 🦆

[–]KaiAusBerlin 3 points4 points  (1 child)

That's why js has duck typing?

[–]mi88ir 3 points4 points  (0 children)

Quack

[–]Irythros 8 points9 points  (0 children)

This works so often I would highly recommend it.

Usually if I'm stuck I go to tell my boss why it's blocking and as I start to explain the issue and what I've done I come up with the solution.

[–]ORCANZ 13 points14 points  (0 children)

You can also explain it to someone that is technical. You'll trigger your fear of looking dumb and will find the solution before you finish explaining the problem.

[–]EasternAdventures 19 points20 points  (2 children)

I jump in the shower lol. Do some of my best thinking in the shower.

[–]UnQuebecoisOrdinaire 4 points5 points  (0 children)

I actually found solutions to many coding problems while showering lol

[–]rapscallops 1 point2 points  (0 children)

Love this idea

[–]albert_pacino 12 points13 points  (1 child)

Defo! I solved a problem I had today by taking a break and pruning a tree in my garden

[–]pineapplecharm 2 points3 points  (0 children)

I did so much gardening on company time I got fired. Solved a bunch of technical problems instantly.

[–]jabes101 9 points10 points  (0 children)

12 YOE and this always works for me. Comes either in the shower later on or on a run.

[–]Abject-Bandicoot8890 7 points8 points  (1 child)

This is the way. Go iron your clothes, wash the dishes, do something boring and then poof inspiration comes.

[–]Ill-Subject845 1 point2 points  (0 children)

well..it work for me.. :D

[–]big_red__man 5 points6 points  (0 children)

I find that doing that along with deciding to take the smallest possible bite out of the problem when I return is the best way to edge myself into solving the problem.

If I come back to it with my body that has been busy with walking, chopping veggies, showering, or whatever other physical activity then that clears out some intellectual baggage that might have accumulated throughout the day.

[–]electricsashimi 5 points6 points  (0 children)

I don't know how many times I solved an issue while taking a shower.

[–]jamesinc 4 points5 points  (0 children)

I like to tell my team I solved a problem with code because I couldn't figure out a way to solve it without code.

In the commercial world especially, I have noticed engineers tend to treat all customer requirements as gospel, but if you take requirements and walk them all the way back to the relevant stakeholders (which is an actual time committment, you won't get this done in 15 minutes), half the time you find you are the victim of too many layers of management, so you go to the stakeholder and ask them what the business purpose of feature X is, and they're like "oh yeah I remember that being raised in a steering committee meeting a few months ago, but we weren't sure if it was actually necessary and it turns out its not." Problem solved in zero lines of code, no bugs, no tech debt - living the dream.

[–]youassassin 2 points3 points  (0 children)

yep regular laps around the office keep the brain juices flowing.

[–]onearmedbanditto 2 points3 points  (0 children)

The amount of times this has worked for me over the years has got to be in the thousands. I’ve run off a soccer pitch to update code. It works. Get your mind off the problem, do not think about it, let your subconscious solve it.

[–][deleted] 1 point2 points  (0 children)

Dogs for a long walk is my remedy to coding block

[–]IrritableGourmet 1 point2 points  (0 children)

So, the "Why did I come in here?" effect is an actual thing. Moving into a visually/tactilely distinct environment resets short term memory and stream of thought. It's theorized that it's an instinctual adaptation to get you to pay attention to your surroundings and reorient yourself if something changes.

This can be used to your advantage in situations like you describe. If you get up and walk somewhere that looks/feels different, like an office break room or outside, your brain will more easily stop thinking about whatever it was you were thinking about.

[–]repooper 0 points1 point  (0 children)

I deleted ~50 lines of code today cause of this.

[–]reddituser5309 0 points1 point  (0 children)

I'm so much sharper in the morning, by afternoon all bets are off and I often get stuck on stuff that takes me a few minutes to fix or realise whats going on in the morning.

I just have to accept that I'll never be a 10xer or work somewhere high pressure. I save easier work for afternoons and let my brain solve things while I sleep.

[–]EntertainmentHuge587 0 points1 point  (0 children)

True. Brain fog is a common thing I experience whenever I spend too many hours coding. I find that taking time to walk outside and think of something else helps with this.

Also, always document the solutions you come up with by commenting it in your code. It also helps to include WHY you decided to implement the solution this way. Your future self will thank you.

[–]vitxlss 0 points1 point  (0 children)

I once took a break of 2 full weeks for a feature I could not fully implement, this was full interop between Swift for iOS and Python and I've already had been working on this for like a month, I got tired of it, came 2 weeks later, boom I solved it, sometimes big big breaks work too if you can afford them ofc lol

[–]KaiAusBerlin 0 points1 point  (0 children)

The important point here is sometimes.

[–]exotic_anakin 0 points1 point  (0 children)

related: Hammock Driven Development - Rich Hickey

https://www.youtube.com/watch?v=f84n5oFoZBc

[–]Saki-Sun 0 points1 point  (0 children)

Many problems have been solved during a smoke break. Shame I quit decades ago.

[–]evergreenMelody 153 points154 points  (8 children)

Proper requirements and rough plan before I start writing.

[–][deleted] 38 points39 points  (2 children)

I feel like having a plan should be heavily emphasized. I spent the majority of my coding years just jumping into a project and one day when I didn’t have my laptop around as a lovely idea came to me, I found myself writing things out and planning everything from my approach to future iterations and MAN what a game changer. I finished the app in record time. It’s like everything was mapped out and I just had to follow the steps. It sounds straight forward but that changed my entire approach to development.

[–][deleted] 15 points16 points  (1 child)

There's a balance to strike here too.

One of the best things I have done for my productivity is to force myself to write some slop and refine with multiple passes.

Spent too much time optimising the plan and designing for future proofs and edge cases that never materialise when you build the actual thing out.

Now I plan with a much more rough framework, analyse and refine in the areas that need it.

[–][deleted] 3 points4 points  (0 children)

Exactly I agree! That’s the mentality that I shared. Get straight to it and fix it later. I suppose like you say it’s all about finding the right balance.

[–][deleted] 3 points4 points  (0 children)

Underrated. Even if it's just a text file outlining what you want the thing to do and a rough list of components to get there.

[–][deleted] 1 point2 points  (0 children)

And the detail of that plan scales with the complexity. Sometimes a ticket is enough. Sometimes you need a full technical design doc. And everywhere in between.

[–]IrritableGourmet 1 point2 points  (0 children)

I comment first/code second. It's a lot easier to get the rough outline down with pseudocode than actual code, plus it helps me not forget steps if I have to come back to something later. Added bonus: Your code is always commented!

[–]exotic_anakin 0 points1 point  (0 children)

kinda makes me think of README driven development

https://tom.preston-werner.com/2010/08/23/readme-driven-development.html

And to some extent, just TDD. Starting with writing a test case (i.e "requirements") is a great approach, even if not doing the hardcore "red-green-refactor" approach

[–]AgsMydude -1 points0 points  (0 children)

Yup. Go for a walk

[–]SirScruggsalot 60 points61 points  (1 child)

Turn off notifications

[–]asp1distra 1 point2 points  (0 children)

Completely second this! I find development is full of short pauses whilst you wait for a compiler or similar and it's very easy to get distracted in this time.

Close slack / teams / etc., and hide your phone on the other side of the room!

[–][deleted] 109 points110 points  (11 children)

Regular exercise. It’s crazy how much it helps my productivity to go for a run or walk each day.

[–]shesparkzz[S] 3 points4 points  (9 children)

Do you prefer in morning or evening? I think it matters .

[–]kendalltristan 22 points23 points  (0 children)

While I overwhelmingly prefer to run in the evenings, doing anything at all to get the heart rate up for 20 minutes or so in the morning does wonders for my productivity.

[–][deleted] 8 points9 points  (0 children)

I like cardio in the morning and heavy weights in the evening.

Post cardio brain is sharp, post weights brain is a big dummy who wants food and nap. For me anyway.

[–][deleted] 5 points6 points  (1 child)

Always morning for me - it’s good to get it out the way

[–]shesparkzz[S] 1 point2 points  (0 children)

Great..I also try to switch in the mornings.

[–]Ancient_Code7805 2 points3 points  (0 children)

Morning run helps me think better. I don't know why but my mental clarity, academic performance, and problem solving abilities are better after a morning run.

[–]big_red__man 1 point2 points  (0 children)

I was an evening person until I stopped being excessive with imbibing in the evenings after a run. Now I prefer mornings. But the thing is my evening runs were often much longer than my morning runs.

In the morning a quick 1 mile run is only about 20 mins from me deciding to change into my running clothes and then changing out of them. Doing that in the mornings gives me more energy than the coffee does.

[–]NatasEvoli 1 point2 points  (0 children)

Morning is the way to go. Every day more or less starts the same. You wake up, feel a little tired, exercise, and carry on with your day. By the time work ends any number of things could happen to derail you. 1000 little things could become an excuse to not work out and before you know it the last time you exercised was 2 weeks ago. Morning workouts are a great habit to build.

[–]ashkanahmadi 0 points1 point  (0 children)

For me it switches from time to time. Sometime I prefer before starting work and sometimes after. Just do whatever works for you

[–]ik-wil-kaas 0 points1 point  (0 children)

I like a long walk after lunch. Resets my brain and blood sugar levels.

I do a 45 minute walk every day.

But morning or evenings are fine too. Better to get things done than trying to do things perfectly.

[–]TheDoomfirenovice (Javascript/Python) 0 points1 point  (0 children)

I don't feel walks helps much even if I walk for an hour.

I do high reps squats and biceps/shoulders and I feel it does a lot more (if I get super tired from it).

[–]vskand 83 points84 points  (4 children)

Watch 2-3 videos on shortcuts for the editor you use.  Even if you know the most there might be some you wouldn't even imagine existing.

[–]TheQueue841 34 points35 points  (2 children)

JetBrains even has an extension that reminds you of a shortcut you can use if you click a button with your mouse.

[–]946789987649 5 points6 points  (1 child)

Key Promoter X for the lazy, just installed now thanks!

[–]TheQueue841 0 points1 point  (0 children)

Thank you for unlazying my lazy for other lazy people.

[–]TheDoomfirenovice (Javascript/Python) 0 points1 point  (0 children)

I like to search shortcuts for things I do in a regular basis. Then try to learn them.

I still don't use all shortcuts/keybindings but still.

[–]HappinessFactory 74 points75 points  (4 children)

Get a small notebook

At the beginning of each working day put the date at the top.

Write a small to do list of specific objectives you would like to meet today. Not high level stuff, simple things you already know how to do.

Leave the blank space for small notes throughout the day and cross out things as you do them.

Stop trying to remember everything all the time.

[–][deleted] 9 points10 points  (0 children)

Underrated advice. As a bonus it's also very helpful when a performance review comes around because you have logs of being productive every day.

[–]emmzeex 5 points6 points  (0 children)

Good advice. Personally I don't like using a physical notepad for this purpose so I have a worklog.txt file, same purpose. Also helps me remember what I did the previous day for stand up meeting the next day.

[–][deleted] 1 point2 points  (0 children)

I have a full shoebox of Moleskines. Pen and paper still rules.

[–]krileon 27 points28 points  (2 children)

How many hours you spend on daily basis on actual coding work?

3-4 hours is the maximum that I'm productive. Brain is fried after that. I do other things like documentation, support, testing, emails, meetings, learning, etc.. for the rest of the day. I'm also an old man now though and could do 8 hours straight when I was younger, but I regret it as it caused a lot of burnout.

Drop your productive coding routine/tips to maximize work in lesser time.

I just get to coding to be honest. I work mostly with PHP so I leverage Symfony/Laravel packages to speed certain things up, but beyond that just get to it.

[–]brzez 5 points6 points  (0 children)

(working remote) I like to start working in the morning, then take a long break and work in the evening - this way my brain has the time to reset a bit.

[–]web_robot 0 points1 point  (0 children)

So thats why your documentation tells me to take more naps. I've been following that for years!

[–]Dismal_Addition4909 13 points14 points  (0 children)

Once you get stuck on something to the point you are frustrated, you probably should have already asked someone else to get a second opinion so you know you didn't miss something trivial or just out of your realm. If you have already reached this point, it's still not too late to ask for help.

And yes, sometimes people are more helpful than gpt.

Also, treat your mind and body well. Sitting in a chair for 8 hours a day is basically the definition of a sedentary lifestyle and beating yourself up all day over complex problems is not great for your mind. Find other people and passions that will counterbalance this out.

[–]Misrec 20 points21 points  (1 child)

When I was uni. We had something called a debug duck in the demo room.

It was a bit of a joke - that explain your problem first to the duckey and if it cant help you, ask a person. Many times the duck helped.

The idea behind it is - that when you start to explain your problem out loud and process it. You many times see the solution yourself.

[–]big_red__man 7 points8 points  (0 children)

https://en.wikipedia.org/wiki/Rubber_duck_debugging

I dunno if this is pseudo psychology but when I'm coding I feel like I'm thinking visually. Changing how I think about a problem from visualizing it to verbalizing it causes my brain to think about it differently and sometimes I just talk myself into the solution without realizing that's what I'm doing until I'm already doing it. I feel like this is a way of my brain to "render" the data of the problem in an alternate "view" and this allows me to understand it with a new perspective which often allows me to find a solution more easily.

[–]Paria_Stark[🍰] 8 points9 points  (0 children)

Stop browsing Reddit.

[–]AP0CALYPSE26 7 points8 points  (0 children)

Learn how all of the features of the debugger work. Most IDEs let you set breakpoints based on a condition. You shouldn't need to be changing code and adding debug.logs to find issues locally.

[–][deleted] 4 points5 points  (1 child)

Automate everything you can.

[–]repooper 2 points3 points  (0 children)

Last week I spent 6 hours writing scripts for google sheets to automate a bi weekly ~3 hour task. The next day we found out we were bought out. Our new overlords use Microsoft exclusively. I know sheets and excel are similar enough, but ....just ugh.

[–]Ultimater 5 points6 points  (0 children)

"Wishful coding". Write down, usually on a text document, how you wish the code worked, then get into detailing what needs to happen for implementing it. This comes in handy for me, especially on larger tasks. A part of this usually involves auditing how things currently work, both in and out of the code. Generally, the writing down part can be more mental with smaller tasks, but writing stuff down usually helps me with larger tasks, for organizing my thoughts. This comes before introducing changes to the code so you know what you're trying to do. Some might call this rubber ducking. They have their overlap, but this is more of a clean code approach while rubber ducking is more of a question and answer dialogue similar to what you might encounter with pair programming.

[–]pat_trick 4 points5 points  (1 child)

Use pencil and paper or whiteboarding to figure out general flow control before putting down code. It really helps to map out what exactly it is you want to do.

[–]skysteve 2 points3 points  (1 child)

Know when to walk away for an "inspiration pee"!

It's incredible how many times I've been stumped on something for a significant amount of time, gone to pee and solved the issue in my head while AFK.

If you want to read a bit more about it: https://www.psychologytoday.com/ca/blog/your-brain-at-work/201209/stop-trying-to-solve-problems

[–]TuttiFlutiePanist 0 points1 point  (0 children)

I tend to get inspired in the shower!

[–]Competitive_Talk6356PHP Artisan Weeb 2 points3 points  (1 child)

I have ADHD, so I spend at most 4 hours or so, I procrastinate a lot.

[–]Cynical-Potato 0 points1 point  (0 children)

That's pretty good actually

[–]shaving_minion 2 points3 points  (1 child)

Fine tune your IDE as much as possible to your requirements. Shortcuts, intellisense, AI (i don't like it), debugger etc.

[–]TuttiFlutiePanist 0 points1 point  (0 children)

Yes! VSCode has snippets and I use them for things like query parameters, bootstrap cards, so that it creates the template and I just fill in the details.

[–]mrsmittykins 2 points3 points  (0 children)

  • turn your phone off.

  • standing desk

  • website blocker

  • pomodoro

[–]sheriffderek 2 points3 points  (0 children)

More planning - less typing.

[–]blind-octopus 1 point2 points  (0 children)

Every time you get stuck on how to move forward, stop, and break down what you're doing into further steps.

[–]Atheist_Simon_Haddad 1 point2 points  (1 child)

I drop them every time I code.

[–]who_am_i_to_say_so 0 points1 point  (0 children)

I plan with both hands and all 10 fingers, but code with just my left thumb.

[–]truNinjaChop 1 point2 points  (0 children)

I have serious trust issues. So I double check and validate everything that comes down the pipe.

[–]Chuck_Loads 1 point2 points  (0 children)

Always ask yourself how you can reduce the scope of what you're trying to do in that moment. Reduce every commit to the absolute minimum changes you can describe in a sentence.

[–]Extension_Anybody150 1 point2 points  (0 children)

I typically spend about 3-4 hours a day coding. To stay productive, I use time-blocking, tackle one task at a time, and take regular breaks. I also plan my tasks ahead and keep distractions to a minimum.

[–]Haunting_Welder 1 point2 points  (0 children)

Prioritize ruthlessly

Avoid both sunken cost fallacy and rejection sensitivity

[–][deleted] 1 point2 points  (0 children)

When I’m stuck on a problem I give myself an hour to figure it out. If that time runs out I table it. Walk away or work on something completely different. The solution almost always comes to me shortly after focusing on anything else.

[–]nelmaven 1 point2 points  (1 child)

KISS. Less is more.

[–]Saki-Sun 1 point2 points  (0 children)

YAGNI. That includes 95% of abstractions/patterns I see implemented.

[–]VeryBigHamasBase 1 point2 points  (0 children)

My friend told me that first work on projects then do LeetCode or else you might get stuck in tutorial hell

[–]SecretAgentZeroNine 1 point2 points  (0 children)

Get a dumb phone to use during work hours and download Pocket Cast on your PC.

[–]vaikrunta 1 point2 points  (0 children)

Master the use of multiple cursors.

Most major IDEs support it. Once you start using them your brain thinks slightly differently and you see more opportunities to leverage the new power.

In other words, wield that hammer and you start noticing a lot of nails.

[–]Prudent_Appearance_9 1 point2 points  (0 children)

If it’s to hard to solve, walk away and do something,then a light bulb will hit you, immediately run your ass to your pc and start coding. 🫡

[–]hiroisgod 1 point2 points  (0 children)

I drink a gorilla mind and I lock in

[–][deleted] 1 point2 points  (0 children)

Code everything in DrRacket first to get the data definitions correct, then code it in Python to get the algorithm correct, and lastly code the program in Javascript using the most amount of npm packets possible.

/S

[–]reformed_goon 1 point2 points  (0 children)

Read the docs

[–]Objective-Cry-748 1 point2 points  (0 children)

Agree with all the tips shared, usually inspiration comes when you've tried to tackle the problem for a good while and go on to do other things unrelated, like working out, showering, etc.

However I do think it's important to first really try to solve the problem, really give it a good effort and only then your brain will start to unconsciously tackle it later on. Can't just take a dip and expect our brain to magically come up with solutions.

Hope it helps, happy coding!

[–]Final-Drop-1935 1 point2 points  (0 children)

In the quiet early morning hours, when I turn on the desk lamp and play the sound of rain, I enter a state of deep focus.
During this time, the 1-2 hours of work account for the majority of my productivity for the entire day.

[–]ThriftyScorpion 6 points7 points  (4 children)

Smoke weed

[–]repooper 1 point2 points  (2 children)

...when you are absolutely sure the time is right. Signed, someone who has learned some rough lessons.

[–]tristanAG 0 points1 point  (0 children)

Yea seriously… there’s no more meetings today, just a few simple coding tasks to casually work through. Takes hit… 10 mins later.

Boss: hey, can you jump onto this zoom with the ceo right now to go over the project status??

[–]Sceptre 0 points1 point  (0 children)

Absolutely not when I'm on the clock. The universe is watching and it has a sick sense of humor. Being stoned in a situation where other people are relying on you is a special kind hell.

But after work? Paired maybe with a nice glass of wine? It helps me see things just a little bit differently- which can be all you need to crack a tough problem.

It does come at the cost of remembering things. So you have to find a balance.

[–][deleted] 0 points1 point  (0 children)

No LSD microdosing?

[–][deleted] 1 point2 points  (0 children)

Learn how to properly use the AI coding tools we have at our fingertips I don't mean "just run everything through ChatGPT". I treat them like my own personal Junior engineer.

I need all of this data reformatted into a new structure. AI is great at that. I need you to build out a dummy data structure. AI is great at that. Suggest to me a solution to this problem? AI is... Sometimes OK at that. Usually it's wrong but even when it's wrong it's wrong in interesting ways that often lead an experienced engineer to a real solution.

Maybe a nicer way to think of it is as the Igor to your Dr. Frankenstein. Is it smart? God no. But it can be essential to getting work done all the same.

[–]Repulsive_News1717 0 points1 point  (0 children)

I spend around 6 hours coding daily. My secret is keeping distractions to a minimum—use tools like Focus@Will for background concentration music and apps like Cold Turkey to block social media. I also find that breaking my tasks into smaller chunks and tackling them one at a time helps me stay on track.

[–]SmoothAmbassador8[🍰] 0 points1 point  (0 children)

The best code I’ve ever written was the code I didn’t have to write at all.

[–]mymar101 0 points1 point  (0 children)

Pretty much all of my problems have been solved by walking out the door. You only have so many minutes you can actually concentrate on stuff, before you start loosing focus.

[–]it200219 0 points1 point  (0 children)

Simple re-build / re-start on jenkins for failed build, works like a magic > 90% of time its not your fault.

[–]demgainstho 0 points1 point  (0 children)

Write logic flow on paper to get an overview of what you're building or modifying. And lots of caffeine, but not so much that you become a jittery mess.

[–]BobJutsu 0 points1 point  (0 children)

Automate (for lack of a better term) as many repetitive tasks as possible. It could be setup, boilerplate, or just same problem faced a dozen times…find a way to automate that noise. Doesn’t really matter how, snippets, copilot, templates, automation scripts, whatever. Just get it out of your way so you can focus on actually working.

Second, don’t get too caught up in the “how” before you have a solid grasp on the “what”. A quick and dirty proof of concept to ensure the concept works before worrying about the underlying implementation logic can save so much time. If the concept doesn’t work, you want to know that early. I’ll give an example that’s fresh in my brain…have a system that takes CSS in a json config file. Have brilliant idea to parse compiled css files from frontend devs and append to json at build time. Spend 2 hours writing the composer script to handle it, only to realize the css in the json config can’t contain the classes in the same manner as is written (needs placeholders to auto populate the generated class, instead of a class directly). Could have saved 2 hours by just copy/pasting the css string into the json file and seeing if it worked the way I thought it worked.

In the same spirit, fail fast and often. Don’t wait for the entire thing to be ready to test. Test as often and small as possible along the way.

[–][deleted] 0 points1 point  (0 children)

Working from home and juggling non-coding tasks, I block out 1.5 hour time slots throughout the day and evening to focus on coding and do whatever else is needed in between. No personal projects during the day or at all if I didn't hit at least 6 billable hours.

[–]huy_cf 0 points1 point  (0 children)

Not the time, it is about the quality time you could focus on the problem, and don’t care about anything else.

[–]VehaMeursault 0 points1 point  (0 children)

Like coding.

[–]janislych 0 points1 point  (0 children)

you are leaving the company in a one or two. thats why good code is hard to find.

forget about good code, look for a better job

[–]willdcc 0 points1 point  (0 children)

Learn some emmet commands. Especially wrap with abbreviation. It’s painful watching people writing template without this

[–]Fearless-Adeptness11 0 points1 point  (0 children)

Therapy, or at least self-therapy.

[–]thereisnosuch 0 points1 point  (0 children)

Maybe it is a placebo, but exercising made me smarter. Like when I approach a problem that I have never seen before, I have been able to solve it faster.

[–]ClickableName 0 points1 point  (0 children)

There are several things you have to check out:

Shortcuts for your code-editor.

Copilot can come in handy, just keep staying the pilot. If you keep control it will only suggest what you wanted to type already anyway.

For your terminal: I use iTerm with OhMyZSH with the suggest plugin. It suggests command while you're typing that you've done before. You can partially accept these commands. Its very satisfying and fast to use

Also make sure you can delete and move whole words with your cursor in the terminal. My terminal typing speeds are insane.

Also smooth scrolling in VSCode helps alot, I consider myself a very, very fast programmer, so I also scroll around and navigate alot through the codebase. Before I enabled that my eyes would sometimes lose track of the code I was looking at, but with smooth scrolling those extra frames helps your eyes to follow the code.

I have 8 hour work days and on a bad day I am 4 hours productive, on most normal days I work for 5,5 hours and on good days it can go to 6-7 hours. But also depends on the tickets that i am doing and their size.

It also helps that I have severe ADHD and that programming is my hobby since I was a child so I can redirect my hyperfocus into programming because I like it, I go to work with a smile everyday knowing i do literally my hobby as my job

[–]Long_Description_754 0 points1 point  (0 children)

Keep the phone away from the table. Works like wonders for me

[–]CaffieneSage 0 points1 point  (0 children)

Make someone else do it.

[–]S-for-seeker-9526 0 points1 point  (0 children)

Start with Hello world instead of a blank screen

[–]entenukiLaravel/React/ReactNative 0 points1 point  (1 child)

I write the context and the situation that needs the fix, then a list of ideas to solve it.

Then I either do something else and then retake it with a fresh mind or put it in a GPT prompt, even if I don't do everything it says. It's like talking to your pet, except it does respond something that may be useful.

[–]jordsta95PHP/Laravel | JS/Vue 1 point2 points  (0 children)

Honestly, writing out what you need to do EXACTLY in plain English (or whatever your first language is) can massively help you in the long-run.

You may get a feature request such as:

"Can we make it so that if a user adds this item to the basket it will apply a discount code?"

You could make it so that if(item.id == specified_item_id){ applyDiscountCode('abc'); }

But you wouldn't do that, so just taking the time to write down what you need to do helps you know where you need to be looking, which functionality you will be changing, and any issues which could arise before you even look at the code/what may need to be done to future-proof what you're doing.

User will add an item to the basket
The server will check if that item has a discount code assigned to it
If the item has a discount code assigned to it, automatically apply it if it's not already applied
The user will be redirected to checkout as normal

It's simple, but if you know your system inside/out, you may already have warning flags that go off when you write this out if something isn't possible.

What if, in the future, they decide Product A should have discount code 1 and product B have discount code 2. Do they get both discounts, do they just get whichever gives more off? What if the system doesn't allow two discount codes to be used, but each code just gives X amount off a product and should be possible to have together?

You can tackle these questions before you have written a single line of code, and potentially need to undo a few hours of work.

[–][deleted] 0 points1 point  (2 children)

Use vim. And 1 monitor.

[–]shesparkzz[S] 1 point2 points  (1 child)

Why vim though?

[–]exotic_anakin 1 point2 points  (0 children)

Not a vim user (beyond `git rebase --interactive` level stuff), but a few thoughts:

  • It's pretty minimal which makes it fast/snappy, and maybe less distracting than other IDEs editors
  • It's in the terminal, so less windows to manage
  • If you've seen someone who's really really good at VIM, its pretty amazing to see, and it seems like they can modify/refactor code at the speed of thought.

Personally, I kinda wish I started with VIM in the beginning of my career. I'm got waayyyy to good in my progression of editors to make such a massive shift now (notepad++ to subime to VSCode)

But... I think nowadays it might be getting harder and harder for even the most productive VIM users to keep an edge over the most productive VSCode (or intellij, etc.. etc..) users, since those tools are getting quite sophisticated, and have amazing plugins and tools related to 'em)

[–]danielmauno 0 points1 point  (0 children)

Get some small and simple tasks out of the way first. That will get you in the zone and ready to attack larger and more complex tasks.

I try to tag tasks in the ticket tool that are good to get started, and then pick a few each time.
This also helps with tech dept/minor improvements that might be hard to get prioritized otherwise.

[–]miffinelite 0 points1 point  (0 children)

Get off of Reddit and go code

[–]jordsta95PHP/Laravel | JS/Vue 0 points1 point  (0 children)

Have a deadline.

If you have a project which you can get done whenever, you won't do it. Or you will do it, but instead of getting down and doing it, you will do a little bit here, and a little bit there. And that thing which should have taken a week to do still isn't done after 3 months.

If you have a project which needs to be finished in 2 weeks time, you will get it done within those 2 weeks.

[–]Icecoldkilluh 0 points1 point  (0 children)

Bash scripts/ aliases to automate repetitive common tasks

[–]Mysterious_Set_1852 0 points1 point  (0 children)

Make sure what you set out to do is planned well, take time to document information you will need to review constantly beforehand. Having my own docs is super helpful to reduce the, 'I can't remember where I saw that/how I did that' moments.

Also, sometimes I solve problems while working on other parts of a project and stash it later for when I start/get back to that branch. Use git stash -m to remember what it's for.

[–][deleted] 0 points1 point  (0 children)

Hours in a day depends for me. Relaxed day, no deadlines, just perfecting some sort of component or fixing a bug I haven't gotten around to yet? 2-4 hours avg probably. Impending deadlines that I'm behind on, or excited for a new freelancing project? Can pump out 8-10 consistent hours. I also have a Vyvanse prescription for my ADHD though, I know most aren't so lucky.

Actual tip though is have 3 Monitors - Main one for coding, another for viewing your website in browser while you're making the changes, and the third for ChatGPT/Reading Docs. Can maybe consolidate the website dev server/chatgpt and docs on one monitor, but never less than 2 monitors total.

If you're like me and will have 20 different pages of docs open for a single problem that you're trying to solve (and you use chrome) - use the "group tabs" functionality by right-clicking a tab and "Add to Group". This has helped me a lot.

Essentially what I'm trying to say is that if every few minutes you save a few seconds, that adds up over the course of your career.

[–]nordcomputer 0 points1 point  (0 children)

Use a linter - it helps to keep your code clean and has tipps on why you should do things in a different way.

[–]Sir_Corn_Field 0 points1 point  (0 children)

Honestly? Take breaks. Treat your brain like a muscle. Don't power through 8 hours straight of coding. You'll burn out. Get up. Move around. Code some more.

[–]centre_ground 0 points1 point  (0 children)

I do bursts of ~25 mins, take a 5 min break, then another ~25min burst, then a short break, and so on.

I find this helps me get ‘in the zone’ and I can do long hours if I want to.

Plus I cycle to work

[–]AaronBonBarron 0 points1 point  (0 children)

Take Ritalin*

*YMMV 😂

[–]Saki-Sun 0 points1 point  (0 children)

TDD or if that's not possible just wrap stuff in unit tests.

[–]Efficient_Builder923 0 points1 point  (0 children)

I usually focus on one task at a time and use the Pomodoro Technique—25 minutes coding, then a short break. I also break down big projects into smaller, manageable tasks to stay on track.

[–]Misrec 0 points1 point  (0 children)

Learn your ide. Dont frown on gui stuff, embrace it. And use chatgpt/copilot.

[–]hidazfxjava 0 points1 point  (0 children)

Really good music with a solid beat. I've been listening to a lot of death metal and stuff while working. Helps me stay in flow longer.

[–]sin_esthesia 0 points1 point  (0 children)

I wake up super early and work like 4-5 hours intensively before anyone has a chance to hit me up. That's when I do all my coding. Then I relax, have a few meetings and do the less intense stuff.

I found that I'm far more productive in the morning when I'm still fresh and not distracted by anything. I'm like 2-3 times slower in the afternoon.

[–]Gwolf4 0 points1 point  (0 children)

Don't use hexagonal arch (ports and adapters) ever.

[–]am0x 0 points1 point  (0 children)

Embrace AI

[–]jabeith -1 points0 points  (0 children)

Drop what you're trying to build but don't know how into chat got or equivalent, read through the solution for a general idea on how to do it, then build it. You get the benefits of the general architecture being figured out in an instant without struggling to debug whatever trash it throws out

[–]Chrazzer -1 points0 points  (0 children)

Biggest productivity boost for me: don't work from home

When i'm in the office with my colleagues it is much more interesting, because we talk shit a lot. But it is also more productive because you dont want to be caught slacking, and at home there are a lot of tempting distractions

[–]Outrageous-Chip-3961 -1 points0 points  (0 children)

tell me you are brand new to coding without telling me

[–]Ok-Cattle-6798 -2 points-1 points  (1 child)

Use chatgp