LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-25-2013, 05:45 PM   #1
officerx
Member
 
Registered: Sep 2013
Distribution: centOS, backtrack linux R3, windows 7
Posts: 59

Rep: Reputation: Disabled
Unhappy Advice for being stuck


What techniques do you guys use when your stuck while programming and you don't know what to do next. I like going for long walks to clear my head or run down to the store to buy more soda what about you guys?
 
Old 10-25-2013, 05:51 PM   #2
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Mint 17.3
Posts: 1,694

Rep: Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561
Quote:
Originally Posted by officerx View Post
What techniques do you guys use when your stuck while programming and you don't know what to do next. I like going for long walks to clear my head or run down to the store to buy more soda what about you guys?
A good night's sleep lets you return to the field of battle with fresh-and-rested eyes. That which had you stumped the day before is suddenly obvious.

Daniel B. Martin
 
Old 10-25-2013, 10:32 PM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,569

Rep: Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130
I have two general approaches:

1) When I know what needs to be done, and I'm just trying to figure out the best (only?) way to do it, sleep generally does it for me. Half the time I wake up in the middle of the night knowing what I need to do, so I roll over, type the cliff notes into my phone, then go back to sleep. I find that if I don't write it down immediately I either forget it, or I spend the entire night trying to remember it - either way rolling over and writing it down is just easier.

2) When I really have no idea how to approach the problem, I generally start talking to colleagues. Normally they're of no use, but the simple act of identifying the problem and laying out the parameters for them triggers ideas I never had when thinking about it by myself, at which point I go back to my office, reconsider my approach, and either tackle the problem or revert back to #1. I bet if you interviewed my colleagues you'd get numerous reports of me walking into their office, describing a problem I'm having, drawing figures on their white boards, going silent for 3-4 seconds, then yelling "Hang on!" and dashing out of their office, never to return.

Last edited by suicidaleggroll; 10-25-2013 at 10:40 PM.
 
1 members found this post helpful.
Old 10-26-2013, 12:47 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 8,495

Rep: Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522
Quote:
Originally Posted by officerx View Post
What techniques do you guys use when your stuck while programming and you don't know what to do next.
I google the problem.

I search StackOverflow for the problem.

I search the mailing lists and discussion groups for the tools I'm using, for the problem.

I look for conference videos related to the problem.

I try out solutions that have a chance of working, and test them.

And if these fail, then the solution usually occurs to me either, a) 5 seconds after I walk out the door to go home, or b) when I'm showering the next day. Eureka!

(And if I have colleagues who might be able to help, then yes, I consult with them).

Last edited by dugan; 10-26-2013 at 12:58 PM.
 
Old 10-26-2013, 03:17 PM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 347Reputation: 347Reputation: 347Reputation: 347
When I was a programmer, I never had only one program on which I was working. So, when I got "stuck" on one program, I just worked on another one (from the "high priority" stack, of course, unless that stack was empty, which, IIRC, never happened).

<edit>
Oh, when I was a manager, I spent a lot of time asking my programmers how they were doing, and offering suggestions when they were stuck. I also encouraged them to ask for help when they had a problem. And, of course, we had team meeting where we focused on a specific program task assigned to the team, discussing issues and possible solutions. (And, of course, trying to figure out what, exactly, the client had meant when they put "that" in the specification!?!? )
</edit>

Last edited by PTrenholme; 10-26-2013 at 04:21 PM.
 
Old 10-26-2013, 03:28 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 20,706

Rep: Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090
Quote:
Originally Posted by PTrenholme View Post
When I was a programmer, I never had only one program on which I was working. So, when I got "stuck" on one program, I just worked on another one (from the "high priority" stack, of course, unless that stack was empty, which, IIRC, never happened).
Yes...'changing the channel' always seems to work to get things flowing again. No matter if it's a night's sleep, walk, another program, etc. Sometimes I just browse the web and read a story or two for a few minutes.

Of course...a pint of beer at the pub with lunch helps as well.
 
Old 10-28-2013, 07:57 AM   #7
officerx
Member
 
Registered: Sep 2013
Distribution: centOS, backtrack linux R3, windows 7
Posts: 59

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by PTrenholme View Post
When I was a programmer, I never had only one program on which I was working. So, when I got "stuck" on one program, I just worked on another one (from the "high priority" stack, of course, unless that stack was empty, which, IIRC, never happened).

<edit>
Oh, when I was a manager, I spent a lot of time asking my programmers how they were doing, and offering suggestions when they were stuck. I also encouraged them to ask for help when they had a problem. And, of course, we had team meeting where we focused on a specific program task assigned to the team, discussing issues and possible solutions. (And, of course, trying to figure out what, exactly, the client had meant when they put "that" in the specification!?!? )
</edit>
When you were a programmer and manager wow you have been around what do you do now?
 
Old 10-28-2013, 02:32 PM   #8
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 347Reputation: 347Reputation: 347Reputation: 347
Quote:
Originally Posted by officerx View Post
When you were a programmer and manager wow you have been around what do you do now?
I've been retired for a decade or so.
 
Old 10-28-2013, 05:08 PM   #9
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,342
Blog Entries: 36

Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
Normally they're of no use, but the simple act of identifying the problem and laying out the parameters for them triggers ideas I never had when thinking about it by myself
Blank Stares?
 
Old 10-28-2013, 07:03 PM   #10
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,400

Rep: Reputation: 2583Reputation: 2583Reputation: 2583Reputation: 2583Reputation: 2583Reputation: 2583Reputation: 2583Reputation: 2583Reputation: 2583Reputation: 2583Reputation: 2583
pull out a pencil and paper
yes paper and a #2 pencil

and doodle , well draw the flow chart / logic diagram

or in words jot down a overview

Basically , use a VERY different part of the brain .
 
Old 10-28-2013, 10:02 PM   #11
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Mint 17.3
Posts: 1,694

Rep: Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561
Quote:
Originally Posted by officerx View Post
What techniques do you guys use when your stuck while programming and you don't know what to do next. I like going for long walks to clear my head or run down to the store to buy more soda what about you guys?
Write, in English, an outline of what the program should do. Then write, in English, each small step in as much detail as possible. When this narrative is complete intersperse the English with code. Where the English says, "read input file, range-check the data, write bad data to error log" enter the executable code. Continue until reaching the end.

This method helps to organize your thoughts. When you finish debugging, your program is well-documented because you started with the comments. You intended to write lots of comments, didn't you?!?

Daniel B. Martin
 
Old 10-28-2013, 11:38 PM   #12
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 8,495

Rep: Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522Reputation: 3522
Quote:
Write, in English, an outline of what the program should do. Then write, in English, each small step in as much detail as possible. When this narrative is complete intersperse the English with code. Where the English says, "read input file, range-check the data, write bad data to error log" enter the executable code. Continue until reaching the end.
Code Complete calls this the "pseudocode programming process." It definitely works sometimes.

Last edited by dugan; 10-28-2013 at 11:48 PM.
 
Old 10-30-2013, 04:22 AM   #13
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 878

Rep: Reputation: 208Reputation: 208Reputation: 208
Consciously trying to break it down into smaller parts.

OK
 
Old 10-31-2013, 11:17 PM   #14
shane25119
Member
 
Registered: Aug 2003
Location: Illinois
Distribution: Linux Mint XFCE
Posts: 653

Rep: Reputation: 53
I take a few hours break (work on something else).

I write out the problem in words, draw flow charts- talk my way through the code that does work.

Failing that, I go ask someone else.
 
Old 11-01-2013, 12:27 AM   #15
officerx
Member
 
Registered: Sep 2013
Distribution: centOS, backtrack linux R3, windows 7
Posts: 59

Original Poster
Rep: Reputation: Disabled
After reading all your posts hava shown me that I have been doing things wrong I used to code for a long period and spending most of my time dealing with bugs I used to fix after days of coding,

Thanks guys
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
no support for locale: en_Us.itf8 Stuck found some post but still Stuck!! Suec7832 Linux - Newbie 1 08-30-2011 09:13 AM
Drive stuck, how to I un-stuck it. MikeyCarter Linux - Software 3 08-05-2009 12:57 PM
almost stuck puishor Linux - General 6 07-19-2005 05:04 PM
Stuck in X !! ewto Linux - Newbie 3 11-17-2003 02:00 PM
i'm really stuck here Frustin Linux - Software 5 06-30-2003 05:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration