I agree Keith and on the multiple versions point I would recommend
installing SVN and a client like Tortoise that enables you to upload each
block of work to the SVN repository. If something goes wrong you can revert
back to the last uploaded block very easily and it is great preparation for
industry. Good brownie points if you know how to use a version management
system. They are easy to install and the main thing is learning how to setup
your first repository but there is lots of help out there and it is well
documented. 

Andrew 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Keith Allpress
Sent: Friday, 24 October 2008 10:49 p.m.
To: [email protected]
Subject: [phpug] Re: Efficient way to write PHP codes


Hi Johari
I need to tell you that it is not PHP horrors that is your problem.
All languages and all systems can give you horrors.
Your problem is in the way you approach your project.
The single biggest mistake that new programmers make is to try to do too 
much at once,
writing too much code, and then trying to debug it all in a big batch 
effort.
By their very nature, programming errors are entanglements.
The best approach is always
1. get it going from the very first lines of code you write.
2. keep it going by writing small parcels of code that you can test.
3. test them.
It is the nature of programming, something you do will affect something 
else.
There are many "variables", I mean scientific variables.
Any good scientist tries to get control over them.
The whole point of all of these frameworks and programming techniques is 
just to try to keep the errors isolated.
The idea I am talking about is "incremental development".
Before any large major change or improvement (in your case accessing a 
database) the programmer does a kind of  "checkpoint".
You want to be confident that things are OK to a certain point.
Its like project management, where you have milestones.
You also want to be able to go back to your milestone (a saved version 
that works)  easily.
Keep a good number of versions of your program as you develop it, so you 
can use it to "time travel".
(I have been known to keep over 100 versions of a complex program as it 
develops).
There are many "tricks of the trade" that programmers use to project 
manage their own work.
One way of "going back" when you think you have made a wrong turn, is to 
"comment out" your recent changes.
In fact this is a lot easier than incrementally reloading all your code 
section by section.
You should be easily able to find errors doing it this way, it should 
never take 1 1/2 days just to track down a missing semicolon.
Now in the case of uploading to a server, because you are inexperienced. 
you need to get some confidence in that process.
The amount of code that you upload will depend on how confident you are 
in undertsanding that environment,
so I definietely think that you tried to upload too much at once.
Hope that helps
=K=








Johari wrote:
> Hi,
>
> I'm still new to this forum. Currently I'm at final Semester in CPIT 
> doing Grad Dip in ICT. My project is to build an e-commerce website 
> and I have done the E-R diagram, Data Dictionary, etc for the 
> database. I was given a space at Techlabs Server and I had created a 
> database tables and inserted sample data. I had finished testing all 
> type of SQL queries needed and tested directly with the MySQL Database 
> Server. It's all fine even though I had few difficulties at first.
>
> The "real" problem started when I used PHP to communicate with the 
> MySQL Server. When I uploaded my finished "test" version and run it in 
> my browser, I get a blank page - obviously it's not running as 
> expected, and I didn't know what's wrong with my code. I use Notepad++ 
> to configure the codes.
>
> Therefore, I had to re-code again.... and check my codes line by line 
> comparing to the working codes just to find out what had went wrong. 
> Then I found out that I missed the (;) in one of the codes. This 
> problems, took me 1 1/2 days. That's a setback since I was thinking to 
> write the PHP codes and upload it to the server bit by bit. Now maybe 
> I have to do everything locally, and only upload the final one. But I 
> also want to make sure that it will work with the server (as part of 
> my QA plan).
>
> I have read few books and I was told how to write a good code, but not 
> really how to write it efficiently... so, while I'm still googling 
> around to find an efficient way to write a good code, can anyone can 
> give me some advise based on your experience dealing with PHP horrors?
>
> Thank you very much for your time.
>
> Johari
>
> >




--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to