Results 1 to 11 of 11

Thread: Visualize Code-I feel stupid

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2009
    Posts
    43

    Visualize Code-I feel stupid

    I'm not a smart person(no formal training or a diploma) and I usually end up feeling like a complete idiot when I attempt to code something and get pissed at myself because I can't figure out something on my own (sometimes angry). I find bits and pieces of some other code and hack it to shreds and throw it together in my own code to make it work. Now, I have a really great idea for a new feature that is in win7 and I can't ask for to much help with out giving away my idea.

    What I do sometimes when I get stuck is I grab a beer and a smoke and sit on my front porch and relax a few minutes. Then I visualize code in my mind almost as if I'm actually typing it out. Even though most of the time that doesn't help a lot, although it does occasionally(almost asleep in bed and it pops up in my mind). I get out of bed run to the pc before I forget and type the very rough implementation in a text. I will work on one part of a project. Albeit, it will be messy. Then even if it isn't finished. I start working on another aspect of the same project. Almost, like I jump around in the same project working on different areas at random times.


    So my question.

    What do you guys do when you get stuck? What are your steps to achieve fluent working code? What tips can you give someone with no real experience?

    Thanks!

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Visualize Code-I feel stupid

    Quote Originally Posted by fattysc View Post
    What tips can you give someone with no real experience?
    Read a good book on the subject.

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Visualize Code-I feel stupid

    Rather than focus on the actual code, abstract it a bit and think about the processes involved.

    Say for example you want to search a database and show the results, you could break that overall process down in to these sub-processes:
    • Check search text is valid
    • Build the query to send to the database
    • Send the query and get the data.
    • If there is data display it, otherwise show a "no data" message
    What I generally do is start a program by just creating comments - starting with a "to do" list of the main process steps (in this example "search") at the very top of the code file, then move on to creating parts of it (such as the code behind a button) with comments containing the kind of list I showed above.

    After that has been done, the code can be added between each comment... and the item removed from the "to do" list.

    If you think of more things later, just add them to the list.

    (almost asleep in bed and it pops up in my mind)
    I get that a lot, so I keep post-it notes next to the bed - find that a brief note is enough to make me remember it in the morning, and not keep myself awake thinking about it (or getting up and writing bad code while I'm tired!).

  4. #4
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Visualize Code-I feel stupid

    I'm similar - no training or anything, and programming is just a hobby really (though it comes in handy at work as I work in IT). I also do the same as you when I'm working on projects, I'll be working away on one section and then just randomly start on a new bit or go fix something I know isn't quite working how its supposed to. I also suck at planning - I find I often code first and think later, which is not a good way of doing it... I end up rewriting so many lines as I change my mind about how something should work or realise doing something the way I currently am doing it will not actually work.
    As for when I get stuck, google is the first port of call but sometimes its not something simple enough or specific enough for you to be able to search for it, so I try and go back to the drawing board and do all of the thinking/planning that I should have done before I even started writing the code. Then if all else fails, ask on this forum
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Visualize Code-I feel stupid

    Pretty nearly anything that interrupts your normal routine can be useful when stuck on a problem. I tend to lie on the floor with a pad of paper. Sometimes I even write something on the paper. Other time I wander in laps around my house. I thought it odd, but I have now read enough to realize that it really isn't odd at all. Few people seem to sit at the computer and work through a problem, as opposed to those who get up and do something else, whether sitting with a beer, or wandering around.

    As for jumping around in the code...I do a fair amount of that when I have lots to write. Work on one class...add something to another class...back to the first...on to a third.
    My usual boring signature: Nothing

  6. #6
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: Visualize Code-I feel stupid

    First off I wouldn't worry about giving away your idea. I have a fantastic idea, so fantastic that I am giving the code away for free in my signature, the thing is that not many people have the drive to implement someone elses idea so don't panic.

    As a smoker I tend to go off away from the computer and have a smoke while thinking about the idea abastractly. The thing about code is that it can be very precise. That is not how we think naturally so there are very few people who write code in a one pass fashion. I like to start with a major concept and build the structure and work my way down to the finite details. I will do things like use values in code rather than consts and code load of stuff in a method until I have enough to warrent seperation, by that time I am pretty confident in the structure of the code so its mostly copy and pasting.

    I also keep an expensive notepad and pen at my desk at all times. The pen is a cross and the pad is one of those artist pads with the expensive paper that has no lines. I use it for doodling out ideas. The idea behind the expensive pad is it is nice to write on and as for the pen that is simply because I tend to misplace anything that is not of significant value . I find it hard to conceptualise idea's in a structured program like work or onenote and only tend to use them once I have doodled out the idea first.

  7. #7
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    Re: Visualize Code-I feel stupid

    I think you can see from the responses that what you do when you are stuck is actually pretty normal, i know that if i am stuck on how to achieve something often i will either work on something else and come back to it, or go off and make a coffee or something. I also do some of my best thinking when i am walking.

    It sounds like the main thing that would help you is to plan a little more. Write down what you want to achieve and break it down in to more simple steps.

    Also finally why not post some of your problems on this forum, sometime all it takes is a different perspective.
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  8. #8
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Visualize Code-I feel stupid

    Quote Originally Posted by DeanMc View Post
    ... and as for the pen that is simply because I tend to misplace anything that is not of significant value .
    I have the same problem, but I use a different solution: I have dozens and dozens of cheap pens scattered everywhere such that there will generally be a pen close at hand, regardless of where I am sitting.
    My usual boring signature: Nothing

  9. #9
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: Visualize Code-I feel stupid

    Yeah I did that at first but the other half wasnt happy about the mountain of pens lying around the house.

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Visualize Code-I feel stupid

    Buy a notebook. Make scribbles and drawings in it.

  11. #11
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: Visualize Code-I feel stupid

    Here's where an iPad could help.
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width