1. Formal methods

This isn't specific to euphoria, but I'm wondering what techniques people use to design programs. I'm thinking about doing a course in formal methods, because I'm tired of hunting bugs in my programs, and formal techniques seem like a good approach to constructing programs systematically. I know they haven't caught on much except in academia and safety critical code, and for most programs it may be like using a sledgehammer to crack a nut, but maybe once you've learned the methods they wouldn't be so time-consuming or difficult. At the moment I use a "top-down" approach with successive refinement, it works well much of the time, but I still get those annoying bugs which for me take the fun out of programming, although some people seem to enjoy tracking them down. Does anyone use formal methods? what are effective techniques for program design?

new topic     » topic index » view message » categorize

2. Re: Formal methods

Bayes said...

This isn't specific to euphoria, but I'm wondering what techniques people use to design programs. I'm thinking about doing a course in formal methods, because I'm tired of hunting bugs in my programs, and formal techniques seem like a good approach to constructing programs systematically. I know they haven't caught on much except in academia and safety critical code, and for most programs it may be like using a sledgehammer to crack a nut, but maybe once you've learned the methods they wouldn't be so time-consuming or difficult. At the moment I use a "top-down" approach with successive refinement, it works well much of the time, but I still get those annoying bugs which for me take the fun out of programming, although some people seem to enjoy tracking them down. Does anyone use formal methods? what are effective techniques for program design?

I've not heard of "formal" methods, can you give us a URL to learn a bit about it?

Jeremy

new topic     » goto parent     » topic index » view message » categorize

3. Re: Formal methods

I don't know how "formal" it really is, but I like Extreme Programming.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Formal methods

jeremy said...

I've not heard of "formal" methods, can you give us a URL to learn a bit about it?

There's an entry in wikipedia (google "Formal Methods"), but it's not very helpful. There are lot of different methods but what distinguishes them as "formal" is that they all use discrete mathematics (set theory and symbolic logic) to design and prove that algorithms are correct. I appreciate that not everyone enjoys maths but it's not the number crunching type of maths, it's more to do with constructing models which mirror your program function and then reasoning about them so that the actual code is much more likely to be bug-free. It might help to look at the page which outlines the course I'm thinking of doing:

http://www3.open.ac.uk/courses/bin/p12.dll?C01M263

If you have a degree in CS (I don't) some of the topics will be familiar, but from what I've heard the usual discrete maths topics aren't presented in a way which makes them useful for program design or verification.

Also you could look at a few pages of this book and read the reviews:

http://www.amazon.com/Science-Programming-Monographs-Computer/dp/0387964800

new topic     » goto parent     » topic index » view message » categorize

5. Re: Formal methods

Bayes said...

This isn't specific to euphoria, but I'm wondering what techniques people use to design programs. I'm thinking about doing a course in formal methods, because I'm tired of hunting bugs in my programs, and formal techniques seem like a good approach to constructing programs systematically. I know they haven't caught on much except in academia and safety critical code, and for most programs it may be like using a sledgehammer to crack a nut, but maybe once you've learned the methods they wouldn't be so time-consuming or difficult. At the moment I use a "top-down" approach with successive refinement, it works well much of the time, but I still get those annoying bugs which for me take the fun out of programming, although some people seem to enjoy tracking them down. Does anyone use formal methods? what are effective techniques for program design?

I have no formal background in programming and no degrees. I'm only an amateur. But here are a few random points that may be relevant to formal methods.

There is a difference between a large project (100 programmers 5 years) and a small project (1 programmer). This difference is comparable with the difference between constructing a 30 storey building and constructing a dog house. Constructing the large building involves cranes and a bunch of trades and a bunch of professions and much planning and organizing. Constructing the dog house involves only simple tools and simple skills and few materials and can be done by 1 person in only a few minutes to a few hours.

Question: To what extent do "formal methods" apply to one-programmer projects?

My favorite book about programming is 'Code Complete'. Perhaps elementary by the standard of the gurus around here, but I like it.
http://www.cc2e.com/

I picked up a naming system from Visual Basic and tried to apply it to programs based on wxEuphoria etc. Perhaps I have not yet made it consistent. Here are some examples:
btnFave btn indicates a wxButton
btnCrap
txtFilter1
txt indicates a wxTextCtrl
txtFilter2
txtFilter3
chkLimit chk indicates a wxCheckBox
chkWater
lblSelectedFood
lbl indicates a wxStaticText (or label)
lblSelectedNutrient
lstFoods lst indicates a wxListCtrl
lstDiet
boxLeft
box indicates a wxBoxSizer
boxRight
etc.

You can tell at a glance what widget it is by the 3-letter prefix.

The prefix 'color' for colors:
colorProtein = create(wxColour,{255,0,0}),
colorCarb = create(wxColour,{255,255,0}),
colorFat = create(wxColour,{255,255,255}),
colorFiber = create(wxColour,{0,255,0}),
colorAsh = create(wxColour,{0,0,0}),
colorWater = create(wxColour,{75,75,255})

I usually put constants in upper case, variable in lower case.

Naming of files (as opposed to variables and constants) is another subject. In the following examples, the prefix 'fcr' indicates what project the file is part of and removes any possibility of a filename clash.
fcr.exw
fcr-data.e
fcr-game1.e
fcr-game2.e
fcr-game3.e
fcr-general.e
fcr-internet.e

About planning a program. In large projects (100 programmers 5 years), that is called 'specifications' and it's a big deal. In small projects (one-programmer projects), planning (of point and click projects) seems to be:
Assuming you have an idea for a project:
What widgets will it use and what will be their placement? (What will it look like?)
What will happen on each event on each widget? (What will it do?)
When you have answers to these questions, you have a plan. The details probably can be winged.

Planning a large project (100 programmers 5 years) is not so simple; I know next to nothing about that.

This is the end of my lecture. Now I will let one of the gurus get on the soap box.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu