I'm starting a new project with 3 other developers. We'd like to stray away from the mess of code our original project is, and employ some "best practices". Unfortunately, there is so much junk out there, that I don't know what actually works, and what is a fad.
We currently use SVN, this will be staying.
We use custom SQL functions. I'd like to change these to PEAR::DB, as I'm familiar with it (previous job) and really like it. Is there another abstraction layer that blows it out of the water?
We've got classes in our current setup, but they're recent additions and few and far between, we already decided that we're moving to php5 oop. However, I think I'm the only one who has researched ANY design patterns, and even I couldn't list more than MVC off the top of my head..
I'm considering test driven development, but I still can't wrap my head around it and I'm not sure if it's 100% worth it or not.
So, I ask you, what works? What are your personal experiences with external tools (SVN, etc), internal tools (PEAR, SimpleTest), or code theory (typeName, ie. intBirthDay), etc.
Thanks!
ReLearning Programming
Moderator: General Moderators
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
PEAR DB is likely one to consider - technically it's heading towards Dodo status (extinct). PEAR MDB2 could be looked at as it's spiritual successor. Another factor is that PDO with PHP5 makes it very easy to roll your own system if preferred and the range of database support isn't too broad.
I still use Subversion, though I'm experimenting with using a personal GIT repository for managing local changes alongside it. The idea here is to let me commit finer grained changes to GIT, and from there push them to the remote SVN repository (very handy since I work a lot from a laptop on the go, and I am still stuck on dial up at home - about to fix that by going all out with a satelite uplink of all things (desperation
). So far using GIT in this fashion has been interesting - I can manage local commits, rollbacks etc. without needing SVN access and do tons of experiments without SVN branching all the time (I hate fine grained SVN branching so that may just be my personal preference).
, and I've already quietly withdrawn from one large OS project because it was driving me up the wall by over analysing every minute detail and spending atrocious amounts of time reworking to death every feasible implementation of a dumb simple idea. Exact opposite of my preferred XP approach to development.
I'd give it a shot in a small way - just enough that you can force yourself to keep it up without spending too much time. The biggest problem with TDD is that it takes so long to get to the point you're applying it efficiently. I'm currently doing a lot of BDD work (one of the most popular TDD variants in (at risk of death) Ruby) since it's the TDD approach I find myself most productive with - it's still weeks from an initial release but my main contribution is the PHPSpec framework.
If you do on a small scale and stick with it, it starts making huge sense eventually. A tipping point is when you lose all fear of making changes to code and you end up just writing code off the top of your head and applying some refactoring afterwards. Once your tests/specs capture the behaviour you want (the B word is essential!), and the code works, then who cares? A little tidy up after and nobody (except arborint maybe
) would think you hadn't spent hours worrying about design and UML charts. Just takes some patience, and not going overboard the first time around to the point the hurts your bottom line for the project.
TDD is far easier if you have a grasp of most basic patterns - means less thinking and worrying about if a design you're led to will work or not. I'd almost say Patterns are the most fundamental thing to start with - Jason Sweat has a very well written and concise book on them written with both PHP4 and PHP5 examples - he even includes Unit Tests for each. I doubt it's very expensive to get the PDF version from PHP|Architect. It's priced in CAD
.
Other internal tools I use include PEAR. Unfortunately many of the small useful packages tend to be Alpha, with a train load of bugs, and are written for PHP4 (some have PHP5 versions if popular enough to warrent the attention of a good sized dev team). The larger ones are better - esp. if they have a "2" in the name indicating a significant overhaul or migration to PHP5. I use SimpleTest and recently PHPSpec for applying TDD or Unit Testing. I also find PHPUnit's Selenium integration useful for web testing of app UI's to make sure they meet the intended client requirements. Familiarity with PHP5's DOM and SimpleXML is almost obligatory - I use both all the time. Same goes for PHP5 SPL - though the documentation for SPL sucks badly.
Code theory - not sure what you mean here. At the most basic level I follow the PEAR Coding Standard for OO code since it's so common any other standard tends to be much harder for other familiarised developers to follow. Mixing global functions and variables with OO is a nightmare also - it takes real work to track that kind of thing (and it's rarely tested anyway with unit tests).
I still use Subversion, though I'm experimenting with using a personal GIT repository for managing local changes alongside it. The idea here is to let me commit finer grained changes to GIT, and from there push them to the remote SVN repository (very handy since I work a lot from a laptop on the go, and I am still stuck on dial up at home - about to fix that by going all out with a satelite uplink of all things (desperation
I'm biased here - I'm on a stint of converting PHP into my all out preferred platform by writing libraries for Behaviour-Driven Development, Mock Objects, and Mutation Testing. But I couldn't survive without TDD/BDD - I'd be terrified in a project where it's not appliedI'm considering test driven development, but I still can't wrap my head around it and I'm not sure if it's 100% worth it or not.
I'd give it a shot in a small way - just enough that you can force yourself to keep it up without spending too much time. The biggest problem with TDD is that it takes so long to get to the point you're applying it efficiently. I'm currently doing a lot of BDD work (one of the most popular TDD variants in (at risk of death) Ruby) since it's the TDD approach I find myself most productive with - it's still weeks from an initial release but my main contribution is the PHPSpec framework.
If you do on a small scale and stick with it, it starts making huge sense eventually. A tipping point is when you lose all fear of making changes to code and you end up just writing code off the top of your head and applying some refactoring afterwards. Once your tests/specs capture the behaviour you want (the B word is essential!), and the code works, then who cares? A little tidy up after and nobody (except arborint maybe
TDD is far easier if you have a grasp of most basic patterns - means less thinking and worrying about if a design you're led to will work or not. I'd almost say Patterns are the most fundamental thing to start with - Jason Sweat has a very well written and concise book on them written with both PHP4 and PHP5 examples - he even includes Unit Tests for each. I doubt it's very expensive to get the PDF version from PHP|Architect. It's priced in CAD
Other internal tools I use include PEAR. Unfortunately many of the small useful packages tend to be Alpha, with a train load of bugs, and are written for PHP4 (some have PHP5 versions if popular enough to warrent the attention of a good sized dev team). The larger ones are better - esp. if they have a "2" in the name indicating a significant overhaul or migration to PHP5. I use SimpleTest and recently PHPSpec for applying TDD or Unit Testing. I also find PHPUnit's Selenium integration useful for web testing of app UI's to make sure they meet the intended client requirements. Familiarity with PHP5's DOM and SimpleXML is almost obligatory - I use both all the time. Same goes for PHP5 SPL - though the documentation for SPL sucks badly.
Code theory - not sure what you mean here. At the most basic level I follow the PEAR Coding Standard for OO code since it's so common any other standard tends to be much harder for other familiarised developers to follow. Mixing global functions and variables with OO is a nightmare also - it takes real work to track that kind of thing (and it's rarely tested anyway with unit tests).
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Good choice.We currently use SVN, this will be staying.
I'm not a fan of DB abstraction classes myself, to much bloat to little return, but if it works for you, giver. I would suggest using AdoDB Lite - Google it.I'd like to change these to PEAR:B, as I'm familiar with it (previous job) and really like it. Is there another abstraction layer that blows it out of the water?
Not sure what your asking here. MVC is a good idea. If you can't wrap your head around it and your using PHP5. Consider using Zend Framework or Symphony, so you can get started developing application code.We've got classes in our current setup, but they're recent additions and few and far between, we already decided that we're moving to php5 oop. However, I think I'm the only one who has researched ANY design patterns, and even I couldn't list more than MVC off the top of my head..
I'm considering test driven development, but I still can't wrap my head around it and I'm not sure if it's 100% worth it or not.
TDD. Some swear by it others don't even bother. Personally, I can see the benefits but haven't yet followed it religiously. I would recommend trying to get into the habit.
I already spend an equal amount of time writing inline tests anyways, so why I don't jump over to TDD is just pure laziness.
I work alone so SVN is something I don't use regularly - although I should, if for any other reason for a perpetual undo/rollback. Working in a team it's essential.So, I ask you, what works? What are your personal experiences with external tools (SVN, etc), internal tools (PEAR, SimpleTest), or code theory (typeName, ie. intBirthDay), etc.
I've looked into both SimpleTest and PHPUnit. I think I prefer PHPUnit but most around here use SimpleTest.
Coding conventions. Personally, it's one of the most important aspects of development. I can't stand code that has no convention.
variable names, class names, file names, directory structure, etc. I find that less and less I need to comment code, the more I standardize my coding habits.
There is little point in wasting space using hungarian notation in PHP - keep the variables terse.
I prefer adodb instead of pear
I prefer adodb intead of pear. Personally I dont like using a library to find out is obsolete. That what they did to pear db.
php Adodb is very easy to use with a lot of example. In my case I use oracle a lot and adodb uses the oci extensions that has been recently optimized.
in term of best practice. I always say keep it simple.
If you are use to pear db the syntax is basically identical.
php Adodb is very easy to use with a lot of example. In my case I use oracle a lot and adodb uses the oci extensions that has been recently optimized.
in term of best practice. I always say keep it simple.
If you are use to pear db the syntax is basically identical.