The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 16, 2019, 09:08:50 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Test Driven Development - worth it?  (Read 2703 times)
DangerMouse
Expert
****
Offline Offline

Posts: 244



View Profile
« on: February 27, 2008, 04:19:27 AM »

Hi all,

Been reading quite a bit about test driven development, particularly with PHPUnit. What do you think of it as a methodology? Do you adopt it for all applications or only complex ones? (Next question would be what defines a complex app lol). How about 'behavoir driven development'?

I'm a million miles away from being a professional coder, and don't really have alot of experience in actually 'doing', so to me this just seems like alot of extra coding, albeit leading to benefits in the long run, I'm just curious if you guys think its worth it?

DM
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: February 27, 2008, 07:38:49 AM »

Water cooler lingo and job security talk.

Sometimes I'll write a program to test for my result before I do my code, but in most cases, your "code" should be either fully outlined in your head or on paper before you ever start to code... the tests should already have succeeded *logically* before you touch the keyboard.

The way they describe this at Wikipedia says that it started with the Extreme Programming movement - but it sounds more like the extremely time-costly method to me.

Sort of silly sounding to me really.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #2 on: February 27, 2008, 02:40:38 PM »

Extreme programming does not work too well with "tradititional languages".
It works well with the lisp/scheme/python and maybe ruby family

The reason is that in lisp/python (i am not sure about ruby)
you have a console which you can enter language definitions ie: define function etc at runtime

where comes the power of this.
a good example is where you have a large database csv data that has to be parsed.
to load the data because it is so large lets say takes 10 minutes.

so in ur handy console you create a function to load the data into some sort of data structure.
u then from console in lisp compile the function (into actual machine instructions, in pythons case it goes to byte-code).

you then load ur data.

next u create a function to do queries against it.
in the traditional language, you would have to recompile, reload data, losing 10 minutes.

in lisp/python you just compile the function,
and then run it, if it has a bug, in lisp you can walk its stack, and abort, get back to console and fix.
in C/C++/php etc u would have to recompile the entire proggie and restart. (hence losing the 10 minutes)

in the case of OO in lisp's case, (and probably python) you could include into the class a version stamp in the class.
you create an object
then u decide to change the class definition of the object.

you can then create an "update" function that walks the objects created.
it will then update at runtime ur already created objects.

this is not only very powerful for testing new ideas quickly, but also for other things.
like lets say you where serializing the objects, and saving them, to reload later.

well as u reload the object off the disk, if it is an earlier version, it will automatically update them.
this is extremely powerful for things like object databases.
http://www.zope.org/Documentation/Articles/ZODB1
all of the complexity of a traditional database is gone.

anyway in a nutshell if u are using php it probably is a waste of time.






Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!