The Artima Developer Community
Sponsored Link

Weblogs Forum
Intentional Programming?

9 replies on 1 page. Most recent reply: Nov 14, 2006 8:10 AM by Revence Kalibwani

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 9 replies on 1 page
Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Intentional Programming? (View in Weblogs)
Posted: Oct 7, 2006 9:03 PM
Reply to this message Reply
Summary
I was writing code in front of a colleague of mine yesterday and he noted that my style was a form of intentional programming.
Advertisement
My approach to writing code is to write a program as if there existed a super library which could already perform virtually any task I needed done. This way I simply write my algorithms in a very direct and straightforward manner with little planning or thinking. I then use the compiler to note what functions need to be filled in, which I do using the same technique, and so on recursively. The result of this technique is code which maps closely to what I am trying to achieve -- what my intention is -- and as a result is easy to read and manage.

Intentional programming is similar in that it is related the idea of expressing a programmer's intent in the source code. However intentional programming usually seems to imply the usage of another less formal language, though I don't believe it is neccessary. Here are some links to Intentional Programming on the web:


John Cowan

Posts: 36
Nickname: johnwcowan
Registered: Jul, 2006

Re: Intentional Programming? Posted: Oct 8, 2006 1:20 AM
Reply to this message Reply
Sounds like plain old top-down design to me, circa 1975. Nothing wrong with that.

Davor Cengija

Posts: 1
Nickname: dcengija
Registered: Oct, 2006

Re: Intentional Programming? Posted: Oct 8, 2006 3:06 AM
Reply to this message Reply
We call it (more or less humourously) Error Driven Design (EDD) - you write the code which won't compile, then follow your IDE's error list and fix the errors. As another reader wrote, nothing wrong with that. Put a unit test here and there and you'll get a pretty solid peace of code.

Alex J. Champandard

Posts: 5
Nickname: alexjc
Registered: Sep, 2003

Re: Intentional Programming? Posted: Oct 9, 2006 5:36 AM
Reply to this message Reply
Intentional Programming is definitely something else. Among others it's language independent, and doesn't necessarily constrain your approach to problem solving...

Michael Feathers

Posts: 448
Nickname: mfeathers
Registered: Jul, 2003

Re: Intentional Programming? Posted: Oct 9, 2006 8:04 PM
Reply to this message Reply
> Sounds like plain old top-down design to me, circa 1975.
> Nothing wrong with that.

Yes. Although, you don't have to think about it as top-down design to make it work. I remember Alan Knight explaining it like something like this: imagine that some object will solve the problem for you; your job is to decide how to ask the object to do it.

V.H.Indukumar

Posts: 28
Nickname: vhi
Registered: Apr, 2005

Re: Intentional Programming? Posted: Oct 11, 2006 9:51 AM
Reply to this message Reply
Sounds like Lisp with a skinnable syntax running on a common language runtime (similar, but not restricted to .NET terminology). Along with good IDE support.

Or is there anything more to it which can be explained in a more concrete way?

Peter Wood

Posts: 4
Nickname: quorn
Registered: Apr, 2005

Re: Intentional Programming? Posted: Nov 2, 2006 4:35 PM
Reply to this message Reply
Doesn't this mean you have to code the whole system before anything will even compile and run?

Test (behaviour) Driven Development specifies a small amount of functionality and writes a test as a client of that functionality. The test fails and then you write simple code to make the test pass. Then refactor.

I've been thinking about top down design and divide and conquer and I realised that if you just recursively break down functions or classes you'll eventually end up with no abstraction. High level functionality will depend directly on low level functionality all the way to the bottom.

You need to also periodically move upwards and break the dependencies of the higher levels on the lower levels by making both levels depend on some abstraction. This is Dependency Inversion.

How does this fit with what you're talking about? When do you refactor to introduce abstractions?

astrobe astrobe

Posts: 2
Nickname: astrobe
Registered: Nov, 2006

Re: Intentional Programming? Posted: Nov 4, 2006 12:09 PM
Reply to this message Reply
> I've been thinking about top down design and divide and
> conquer and I realised that if you just recursively break
> down functions or classes you'll eventually end up with no
> abstraction.

The final step of top-down approach happens when you cannot divide further; there teh level of abstraction is the one of the language yo use.

> High level functionality will depend directly
> on low level functionality all the way to the bottom.
>

It seems to be a universal to me, at least from the point of view of a general top-down analysis (animals depends on cells that depends on proteins that depends on atoms etc.).
If by studying the properties of it's components you cannot explain the properties of the object you're studying, you probably miss something.

This approach does use abstraction in a way. By just stating at each stage how a task is performed and on what lower-level functionnality it relies, you do abstract, at each level, the lower levels.

> How does this fit with what you're talking about? When do
> you refactor to introduce abstractions?

The only refactoring activy you may have to do is to factor out similar functionnality that may appear separately in different "branches" of the decomposition, nothing more. The program is normally already well factored by design, so there's no point in inserting extra abstractions that are obviously not required by the program.

astrobe astrobe

Posts: 2
Nickname: astrobe
Registered: Nov, 2006

Re: Intentional Programming? Posted: Nov 4, 2006 12:13 PM
Reply to this message Reply
> Sounds like Lisp with a skinnable syntax running on a
> common language runtime (similar, but not restricted to
> .NET terminology). Along with good IDE support.
>

I thought Lisp was bottom-up; did I misread OnLisp?

Revence Kalibwani

Posts: 3
Nickname: revence27
Registered: Jun, 2005

Re: Intentional Programming? Posted: Nov 14, 2006 8:10 AM
Reply to this message Reply
I've never programmed differently.

You don't have to finish the whole system to see that it works. You can just keep testing how far you are going, and acting accordingly. Or by not writing the whole system at once -- just bit-by-bit. Try it, whoever hasn't. It's simply the only way I can program.

Flat View: This topic has 9 replies on 1 page
Topic: Intentional Programming? Previous Topic   Next Topic Topic: The Muck That Slows You Down


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us