Personal Development for Smart People Forums

Personal Development for Smart PeopleTM Forums

 

Go Back   Personal Development for Smart People Forums > Personal Development > Technology & Technical Skills

Notices

Technology & Technical Skills Computer skills, hardware, software, internet topics, gadgets, programming

Reply
 
Thread Tools Display Modes
Old 04-16-2009, 08:29 PM   #1 (permalink)
Family Member
 
Join Date: Nov 2006
Location: Berlin, Germany
Posts: 8,749
Brutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud of
Default Design before you code

If you want to write code for a program, what do you do before you start coding?

How much design specs do you write before you start writing the program?
How formal are those design specs?
Brutha is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-16-2009, 09:55 PM   #2 (permalink)
Love in Action (Mod)
 
Join Date: May 2008
Location: Ohio
Posts: 2,527
pianoperformer is just really nicepianoperformer is just really nicepianoperformer is just really nicepianoperformer is just really nice
Default

I work with the client (or myself if it's my own project) to get the user stories, and get a priority on each one. Each story is in the format:

Code:
As a [role]
I want [feature]
So that [benefit]
I put each user story into a .feature file (for Cucumber).

Every two weeks, I choose the user stories I will work on in that time, and expand them into scenarios, in a given/when/then format. Again this is supported by Cucumber. This should really only take a few hours of planning.

That's all of the up-front design there is.

I then go to the first scenario I want to code, and just code it. I start from the outside in, working on views first, then the controllers, and finally the models. it's small vertical slices of functionality. But of course I never write code until there is a spec in code to implement it (kind of like tests but thinking about behavior instead of tests). I use RSpec for this. Each layer is tested independent of the other layers. The layer below it is mocked so as to provide that independence.

Once you start writing tests/specs before code, you will never want to go back to designing everything up front, coding, and then testing. That is entirely backwards. Testing before gives you much more assurance that what you are writing actually is what is needed, that it works, and that you have the minimal and simplest code required to make it work. There have been times I had no idea how to design a certain feature, but I just jumped in writing one test, code to pass it, another test, etc, until before long, a design was evident that worked really well.
pianoperformer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-16-2009, 11:51 PM   #3 (permalink)
Family Member
 
Join Date: Nov 2006
Location: NM, USA
Posts: 1,394
Dharma has a spectacular aura aboutDharma has a spectacular aura aboutDharma has a spectacular aura about
Default

I try to get all the specs I can and maybe the ideas they have for the future (so I can write the code loose enough to accept changes).

In thinking of code, I look to where I can reuse code, objects, and processes. Do I need to care about performance? Do I need to make a huge DB and worry about it's performance and efficiency? Multi-lingual? If it's a web app, how much data am I dumping on the user's browser? Am I gonna make low performance machines/56k/iPhone/PDA users crawl?
Dharma is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-17-2009, 12:05 AM   #4 (permalink)
Love in Action (Mod)
 
Join Date: May 2008
Location: Ohio
Posts: 2,527
pianoperformer is just really nicepianoperformer is just really nicepianoperformer is just really nicepianoperformer is just really nice
Default

Dharma,

have you ever looked up extreme programming? Have you ever heard of the red/green/refactor cycle? This article has a good description, too.

The basic idea is that you only test and code whatever feature you are working on right now, and don't plan for future features, because, YAGNI ("you aren't gonna need it"). Your tests describe your scenarios/features, and you only code the simplest thing that'll possibly work.

Further, premature optimization can be rather dangerous.
pianoperformer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-17-2009, 01:10 AM   #5 (permalink)
Family Member
 
Join Date: Nov 2006
Location: NM, USA
Posts: 1,394
Dharma has a spectacular aura aboutDharma has a spectacular aura aboutDharma has a spectacular aura about
Default I don't make databases when I just need a text files or static object, etc.

Yes, I know all about it and I like XP. But, my job is to look into the crystal ball and know what bomb (features!) my customer will drop on me later in the project. Always happens. In a way it is also an efficient model too.
Dharma is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-17-2009, 10:39 AM   #6 (permalink)
Family Member
 
Join Date: Nov 2006
Location: Berlin, Germany
Posts: 8,749
Brutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud ofBrutha has much to be proud of
Default

Quote:
I try to get all the specs I can and maybe the ideas they have for the future (so I can write the code loose enough to accept changes).
You mean you asked somebody else for the specs or do you write specs yourself to have a more concret idea of what your code has to do?
Brutha is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-23-2009, 04:18 AM   #7 (permalink)
Junior Member
 
Join Date: Mar 2009
Posts: 13
CubicleBailout is on a distinguished road
Default

Who is going to do the coding? If it is just you, then your spec could be the code itself and maybe some diagrams of how it will all work together.

Do a work break down structure or create a backlog of user stories (really the same thing) of what the software will do at a high level.

Don't waste time on specs if you don't need to (i.e. coding for yourself).

Oftentimes, I'll create basic file structures for code and put todo lists in there as well as why I'm doing something the way I'm doing it. This goes a long way when you are staring at that same code months later and have forgotten why the heck you wrote it.
CubicleBailout is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-23-2009, 10:50 AM   #8 (permalink)
Senior Member
 
Join Date: Dec 2008
Location: Stuttgart, Germany
Posts: 101
vilbara is on a distinguished road
Default

At minimum, you should write down in simple words what you think your application will do.

Just start writing and soon you will notice questions poping up in your head. Write those questions down. Analyse and answer them.

At the end you will get some specification but this is not the most important. The most important is the act of planning and the insights you've got.

Changing specification takes just a fraction of time you need to change code.

Read Joel Spolsky: Joel on Software

He has written a series about specifications:
Painless Functional Specifications - Part 1: Why Bother? - Joel on Software
vilbara is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-24-2009, 06:05 PM   #9 (permalink)
Senior Member
 
Join Date: Mar 2007
Location: What of it?
Posts: 724
jamestl2 is on a distinguished road
Default

Yeah, simply getting the goals of the program down are where I first start, and ask myself what purpose will this serve Wll I expand on it in the future? Just how flexible does it need to be?
jamestl2 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The Genius Code tbushmoney Personal Effectiveness 1 01-17-2008 08:29 PM
How to sell source code? dci0705 Technology & Technical Skills 2 11-28-2007 05:58 AM
PHP Code that optimizes your HTML Minsc Technology & Technical Skills 1 05-04-2007 03:08 AM
Is there a code of ethics for psychics? Aphrodite Erin Pavlina 2 04-09-2007 06:32 PM
Traffic building code Gazzali Technology & Technical Skills 0 03-01-2007 08:22 AM


All times are GMT. The time now is 02:33 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2010 by Pavlina LLC