Flyspray - The bug killer!

“If debugging is the process of removing bugs, then programming must be the process of putting them in.” – Edsger Dijkstra

This is the Bug Tracking System for the Flyspray project. This is not a demo! Before opening a new task, please read the guidelines!

Do not issue bugs reports against versions earlier than 0.9.9.5

Security problem? Check the security section.

Tasklist

FS#503 - Rewrite the code using functions instead of if-elseif-else

Attached to Project: Flyspray - The bug killer!
Opened by Eelco Lempsink -- Paragin (eelco) - Thursday, 31 March 2005, 00:30 GMT+1
Last edited by Pierre Habouzit (MadCoder) - Wednesday, 09 November 2005, 14:45 GMT+1
Task Type TODO
Category Backend/Core
Status Closed
Assigned To Pierre Habouzit (MadCoder)
Operating System All
Severity Medium
Priority Normal
Reported Version 0.9.8-devel
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

There’s a good reason structured programming was invented. I would like to see the code being rewritten using functions instead of big if-elseif-else.

The pros: the code will be cleaner and more clear, calling the functions can be done with a switch and permission can be handled cascadingly at the start of the file. You will be able to do more than one thing in a call (I ran into this when I tried making a checkbox next to the assigned field that would add the assignee to the notifications list). I’m willing to help.

The cons: it’s a hell of a job, and it’s not very necessary.

This task depends upon

View Dependency Graph

This task blocks these from closing
 FS#601 - Templating backend 
Closed by  Tony Collins (knigits)
Saturday, 07 January 2006, 21:13 GMT+1
Reason for closing:  Complete
Additional comments about closing:  Pierre has 'refactored' the code. Much of it has been moved into classes, and the rest of it cleaned up.
Comment by Tony Collins (knigits) - Thursday, 31 March 2005, 11:01 GMT+1

I wholeheartedly agree that the current use of if/elseif statements is a bit antiquated and messy, and I would happily have it rewritten in the way you suggest.

As for the checkbox for adding the assignee to the notification list - totally not necessary, as the notification code automagically includes the assignee in any notifications about the task.

Comment by Tony Collins (knigits) - Thursday, 31 March 2005, 11:47 GMT+1

If you would like to do this task, I suggest starting on the file that was giving you trouble - scripts/details.php. I would like to hear how you plan on tackling this file. Perhaps if you posted to the mailing list, everyone who _isn’t_ watching this task could also read and perhaps provide feedback on your proposal...

Comment by Eelco Lempsink -- Paragin (eelco) - Thursday, 31 March 2005, 14:53 GMT+1

Ah, I was unaware of that. Maybe then I should file a bug to make that behaviour more clear :) Maybe the assignee can be shown on the notifications list but without the ability to remove him/her? I’ve now been adding assignees to the notification lists manualy (and superflously apparently ;)

As for the rewrite: will do that.

Comment by Tony Collins (knigits) - Friday, 01 April 2005, 00:42 GMT+1

I would like to hear more about how you plan to change the code before you go ahead and do it.

Comment by Eelco Lempsink -- Paragin (eelco) - Friday, 01 April 2005, 17:10 GMT+1

Sorry, that’s what I meant with ‘will do that’, I will post to the mailinglist first.

Comment by Pierre Habouzit (MadCoder) - Monday, 31 October 2005, 11:55 GMT+1

this is totally unneeded IMHO.

I’ve already rewrited most of the pages to be like that :

if (error) {

 // eventually some treatement
 $fs->redirect(...) // does an exit

}

// code for the page

there is no more if/then/else for most of the reasonable (meaning not details / modify e.g.) pages. and modify/details will have their own special treatement during templating.

all in functions is harmfull. pages are in themselves already “functions”. So my guess is, let’s templatize, and we will see if such a rewrite is needed. my guess is, it won’t

Loading...