Fog Creek Software
Discussion Board

Code in Mind

This is mainly for programmers and developers.  Before you start writing the code, how much code you can put in the mind ?.  ie.. Oneline One page or entire project.?

Do you think that writing code in mind can help to actually finish your task faster?

Thursday, December 4, 2003

The mind is a very small working space -- especially my mind.  Sketching things out in a whiteboard usually helps.

Coding starts when I've broken out the problem into discrete (hopefully testable) steps, I'm confident that the plan is complete, and I'm confident in my ability to code each step: there are no more "and then a miracle happens" sections to the plan.

Thursday, December 4, 2003

unless your developing with objects.  I hope.

old timer
Thursday, December 4, 2003

Like Alyosha, I don't get very far with my designs in my head. I'm sure super-programmers can design 4 trillion lines of code all in their heads, but a mere mortal such as myself has to start writing ideas down pretty fast...

I normally just open up Word and start jotting down notes and ideas until I begin to see the framework of an architecture come together. Then I move over to Visio to add more meat to the design.

Mark Hoffman
Thursday, December 4, 2003

Different people are different. I can keep a lot of
code in my head and have little patience with tiny
incremental development steps. Others are the
reverse. Figure out how you work best
and work that way. Neither way is better.

son of parnas
Thursday, December 4, 2003

I like to get the contractual stuff loaded into my head. Once I've got a good overview of concepts, contraints, and relationships between interfaces I tend to use UML to sketch it out and discuss it. Usually the final model bears only a passing resemblance to the original.

Dustin Alexander
Thursday, December 4, 2003

Mind is very important tool for the developer.  We spend time learning UML, Visio,Word or Emacs and allow ourself to get by with the basic funtionality of mind that we have perceived.

Just like computer softwares, if we develop proper skills to use the mind would that enhance our ability to do the things?

Once you learn for example Emacs, you keep learning and discover new things daily which can be helpful to you. 

Shoud mindsoft ask the question:
What new mind-skill that you have learned today?

It's completely possible that the techniques used by someone else can be hidden in you and upon recognition you would start using it just like  add-on modules of your software. What do you think?

While I agree that the  coding space in the mind is limited and non-transferable to someone else, I think that in the minds of  great developers many things are going.. ie.. they have learned to use the mind-space and to extend it.  By practice they develop larger space to work in.

Thursday, December 4, 2003

This is actually a very good point. And very true. Throughout life we all learn tips and tricks for thinking about things that enables us to accomplish more with the same cerebral pinout.

Dustin Alexander
Thursday, December 4, 2003

What worries me about having all the project in my mind is that I feel it is not 'saved', so I could easily end up loosing many lines of code if something interrupts my thoughts and makes some of the unsaved pages off memory to disk (because I still don't have a HD included).

.NET Developer
Thursday, December 4, 2003

Whiteboards, pen & paper to start

But after a while, the code is in my mind.

For example, I system I worked on for 2 years around 1997 had a problem one year ago and I was called to fix something.

To my amazement, I was able to find my way trough it. The architecture and all was still clear in my mind...

Friday, December 5, 2003

After starting to use a test-first approach to development, I've found that I don't need to keep nearly as much 'code in mind' - just what is pertinent to the code I'm writing to pass the test at hand.

I'm still not nearly proficient at it, but already I can see it evolving better design than the "big design up front" approach, and yet at the same time reducing the amount of 'code / design' stuff I need to keep in my head.

Because you're iterating through the 'write test', 'write code to pass the test', 'clean up code which passes the test' so often, you're constantly (re-)teaching yourself how everything fits together.

Because you're never thinking ahead much further than passing the next test, you don't clutter up your mind with
any unclear or loose concepts about the bigger picture and worrying about the maybe's or mights or should's...

I just need to remember to mercilessly refactor after first getting the test to pass. I'm kicking myself for recently not refactoring as early as I should. Each time I had to touch the code, it was easier to make a simple change to address the immediate problem at hand. However, once I finally bit the bullet and did it, and as a result I managed to reduce the lines of code by about 60% - thus making it simpler, and easier to 'keep in mind'.

And re: the emacs comment - finding the "apply-macro-region-to-lines" did wonders to my editor efficiency. All these little things add up over time to make a huge difference productivity.

Gordon Hartley
Friday, December 5, 2003

before starting to code , visualizing in mind how the completed functionality should be always works great for me, helping to produce high quality code.

Saturday, December 6, 2003

When doing serious programming, I get in a zone where I'm keeping far more ideas aloft than I do in my other day-to-day activities.  It's rather like I imagine juggling 10 balls might be, in that any interruption, no matter how short, can bring the whole thing crashing down.  It can takes a lot of time and effort to get back to that point.

Early in my career, and sometimes even today when I must, I would shift my workdays from 1pm through 1am.  I'd still get important social interaction in the afternoon, but when I did my real work, there was usually nobody else around to harm my concentration.

Here's one reason Joel's one of the few people in a decision-making position in this industry who seems to have a clue, and also one of the explainations why Microsoft has been so dominant: programming can't be done well in a cube farm.

Saturday, December 6, 2003

I love the juggling 10 balls analogy. Going to use that myself when speaking to people now since they can't relate to 'the zone', or don't believe that zones apply to programming. But everyone knows that you shouldn't distract a juggler.

Dennis Atkins
Saturday, December 6, 2003

*  Recent Topics

*  Fog Creek Home