/    Sign up×
Community /Pin to ProfileBookmark

If you have maintained others code / done complete e-business website, I need advice.

Hi,

Do you find working on code written by other developer difficult like me?
I am working on this website in PHP.
It was given to me almost 80% complete (so they said) & needed to add new functionality like when membership expires send automatic e-mail or don’t allow user to login after membership expires. It had few bugs also like search doesn’t return correct result.

I have dought about basic structure of website. This website have one folder of all html pages with tags in each page like

<search_location_box size=”5″ name=”searchloc”>

<dbtable name=”MyDB” idfield=”jsid”>

<redir url=”thanks.php”>

<postemail emailfield=”email” template=”templates/email_new.txt”>.

etc etc… & there are all php function in /library/ folder which read these html templates & replaces tags with text boxes & database name.

Function like LoadTemplate(xyz.html);
remove_tag( …. );

replace_tag($tagname, $replacewith, $text)
————-

Even database sql are created on fly not only INSERT but UPDATE is also done on fly, I don’t see any written sql statement:

function GetNewSaveSQL() // this function creates sql statement
{
global $tableinfo; //populated at top of this page

$sql = “insert into ” . $tableinfo->GetName() . ” (“;

$commaflag = false;
foreach ($tableinfo->fields as $fieldname => $field) {
if (! empty($_POST[$fieldname])) {
if ($commaflag == true) {$sql .= “, “;} else {$commaflag = true;}
$sql .= $fieldname;
}
}

$sql .= “) values (“;

$commaflag = false;
foreach ($tableinfo->fields as $fieldname => $field) {
if (! empty($_POST[$fieldname])) {
…………….

Is there any methodology this old developer has used or is it just bad development? Is it me who is not following it? Should I completely redo this project?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@TecBratDec 17.2007 — Coding behind someone can always present a challenge. Most of my experience in this type of situation is an open source shopping cart. At least there is a forum there where I can ask questions. If the guy before you didn't document his code, you'll find yourself digging around trying to figure out how or why he did a certain thing. You might go "Oh, he didn't need to do that. Let me change it..." and then a different part of the site stops working. Then as to your question about re-coding it yourself. Ask youself 1) Are you up to it? Do you have the skills, tools, and time to recode the whole project. 2)Why didn't he finish? {It's easy to blame the previous coder for walking out on a project, but maybe the client kept changing the specs.}

3) Can you figure out this guys template system and then work within it.

Depending on the relationship between the client and the previous coder, you might try talking to him about it as well.

Tecbrat. (I feel sorry for people trying to code behing me.)
Copy linkTweet thisAlerts:
@SH100authorDec 20.2007 — thank you TecBrat.
Copy linkTweet thisAlerts:
@SyCoDec 20.2007 — but maybe the client kept changing the specs[/QUOTE]
too right, that's a major hassle but incredibly common. When I contracted I had the marketing types sign off on the spec (which I usually wrote). Then if there were changes, which was 9 times out of 10, I would tell them I was happy to do it, explain how it differed from the original spec and why that meant it would be an additional cost. Mostly they paid up without too much grumbling or cancelled the upgrade. As an employee when that happens you just have to eat it, until you can train marketing to think beyond the next step.

And yea everyone codes differently and it can take as long to understand it as to re write it. But as SH100 only re do it if you're up to it. Biting off more then you can chew is a major stress and usually ends badly. On the other hand if you can re-do it and will have to support this for a long time then personally I might re write it. Saying that his structure is a reasonably sound way of going, not my style but I've seen it in a few other things. I think PHPBB does it in a similar way but I hate that code. ?
Copy linkTweet thisAlerts:
@TJ111Dec 20.2007 — Reading other people's code is like trying to read a Make your own Adventure book, but without page numbers (If you want to talk to the spooky man, go to the part of this book where you start talking to the spooky man). If it's well documented it takes alot of the stress out, but still it always seem's different programs use different logic then you do.

As far as rewriting the whole thing, that can be "more then you can chew", as other people pointed out. I'd try to go through the code and add comments where ever possible explaining the logic ("this function takes these arguments and does this with them, etc"). If you take the time to do that, usually by the time your done you'll have alot better sense of what the code is doing. If you really think you can handle starting from scratch, then go for it. But I think you'll be surprised at how much more difficult it is.
Copy linkTweet thisAlerts:
@SH100authorDec 21.2007 — I am working on this project from sep 2007 (maybe 20 hours each week).

I think I have given enough time to understanding this code.

But I got very important suggesions from everybody so I contacted old web developer he said

'It's based off a simple templating mechanism to separate code from view, but it's not strict model view controller.'

I am good in coldfusion but started php/ mySql in april 2007.

I am familier with coldfusion development methodology FUSEBOX (it is used for php also)& Object Oriented Programming. I Believe doing this site with Model View Controller will be easy for maintainance.

So not completely but slowly I will change all sql to stored procedure.

Because some sql is embedded in php files & there might have been some triggers(my guess). Since I got only MYI, MYD, frm files & I don't know if it's complete database or not.

If you have any suggestions they are welcome.

Thank you.
×

Success!

Help @SH100 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...