NYCPHP Meetup

NYPHP.org

[nycphp-talk] intro question

David Mintz dmintz at panix.com
Wed Aug 27 10:42:05 EDT 2003


Here's my newbie preachment:

Learn from my newbie mistakes! I was in much the same boat when I decided
to learn PHP/MySQL by developing an ambitious scheduling and record
keeping system for ourselves, the court interpreters in the federal court
downtown.

* The urge to just do it is powerful, but time spent reading, planning
your design, and playing with and testing techniques, is well invested. (I
did my app in an improvisatory, ad hoc way that makes me marvel that it
works as well as it does.)

* While you might not do full-blown Test Driven Development, where you
literally write tests for your code before you write the code itself, you
should use an approach that is similar in spirit and strategy. Test the
hell out of little pieces and make them prove themselves under every
scenario you can think of.
(http://www.phpbuilder.com/columns/reiersol20030126.php3)

* If some piece of code looks like it's getting too complicated, it
probably is too complicated. Step back and rethink.

* Consider using a templating system like Smarty. When HTML and PHP are
blended together indiscriminately, it is torture to read and maintain.
Torture! (http://smarty.php.net/)

* Think about security from Day One, not as an afterthought.

* Consider using classes and objects, like somebody just said. There are
different schools on this, but one nice thing about OOP is that the moment
you begin to think about a name for your classes, you are thinking about
what they are supposed to do and where they fit in with the rest of the
picture -- it automatically encourages you to think.

* Be pretty anal about following your own variable, class and method
naming conventions consistently. For example, will it be this_style or
thisStyle?

* Think about your database schema carefully before you commit to it, then
try to avoid the promiscuous hard-coding of things like table and column
names to the extent possible, so it doesn't cost hours of acute pain when
someone decides that a table needs to be altered. This will also make it
easier to re-use your code on future projects.

* Consider using version control, like CVS. Yes it's yet another tool to
learn, and it can drive you insane when you don't understand it, but
someday you will be grateful for it.(http://cvshome.org/)

* Comment abundantly

* Have fun!


---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!

"Y dále p'abajo"

	Tito Rojas

> Subject: [nycphp-talk] intro question
>
>
> > Hello...
> >
> > I would like to know if PHP and/or MySQL is the answer to my design
> > problem. I have been told so, but I am a beginner to both, and need a
> > good intro tutorial also.



More information about the talk mailing list