[Tutor] New Programmer - Designing

Alan Gauld alan.gauld at btinternet.com
Fri Mar 8 09:59:18 CET 2013


On 08/03/13 03:14, Christopher Emery wrote:

> I am new to this email list as can see from subject, my name is
> Christopher.

Hi, welcome.

> I am trying to learn how to design a program but I seem
> not to find any resource online that will teach how to design the
> program before you start programming.

There are lots of techniques, but mostly aimed at bigger problems.
There is a shortage of information on designing at the smaller scale 
level. One excellent site is the How To Design Programs book which is 
aimed at Lisp/Scheme programmers but is largely applicable to Python etc 
too. (Except you have to convert recursion into loops):

http://www.htdp.org

The other important thing to grasp is the general principle of algorithm 
design which is a branch of math. There are a few web pages and books 
dedicated to that too.

Finally you can use design tools like UML (which I introduce in the OOP 
topic of my tutorial) which can be useful on bigger projects, especially 
if using classes/objects.

> I would like to create a program that will filter a file and put the
> information into two database (text based for now)

 > So how would I start the process of designing such a application?

At this level of design I normally just use pseudo code.
Start with a high level plain English (or whatever your first language 
is!) description of what you want to do - the algorithm. Refine it into 
a structured form that looks somewhat like your programming language of 
choice. Make those your comments. Now for each comment write the code 
that does that part of the algorithm.

> user interfaces, phone, web, mobile I want to learn how to keep code
> apart from UI. For example if a program was created to take a person
> information how would that look?  I tried to think of basic process. so
> in this example I know the following would need be done:
>
> user would pick option on UI to Add, Update, Delete, if add picked then
> grab information from UI as varibles (I am assuming)
> then process would check varibles types are correct and existing
> then process would either give error or continue to storing the information

In general all of the above except the storage would be UI code. If the 
validation required complex logic or access to other data then it might 
be outside the UI too. As a general rule anything that reads or displays 
data is UI. Lightweight data validation (eg type and range checking) is 
usually UI too. Any data processing, transmission, storage should be in 
the logic part of the code.

> So how would one go about designing this module?  Would this be the
> right name to call this part of a bigger program?

I'm not sure what name you are referring to?

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list