Jump to content

Do you follow design patterns?


aspnetguy

Recommended Posts

I have been read about different design patterns, particularly MVC and MVP, as well as unit testing.I certainly have a better understanding now of the the pros and cons of different approaches.What deisgn patterns do you use? How do you unit test your code?

Link to comment
Share on other sites

The only code which I have put to a Unit test (since very recently) is the one from my signature. I haven't created a Unit test suite for anything else before, though that might change.I guess with the XML/XSLT/PHP trio, I'm essentially using an MVC/MVP model at the (small amount) of sites I've made.

Link to comment
Share on other sites

I have a good grasp on MVC and am considering writing my own simple framework but as far as unit testing goes I still feel lost. I don't know of any testing frameworks for PHP but there are a lot for .Net (NUnit, MBUnit, MSTest, RhinoMocks, the list seems endless). In the end I usually find that I over complicate things and am hoping this is the case as well.From what it have read in order to do unit testing properly (or with the least headaches) is to be implementing a good pattern (i.e. MVC or MVP) and keep your functions and classes small and simple or else your unit tests become unmanagable.

Link to comment
Share on other sites

Yeah, I too feel that making Unit tests for anything other than APIs is an overkill. I mean, I can't imagine how a Unit testing suite would look for IPB... could anyone? I'm guessing it would be horrible, and would probably contain 500 tests or more.For an API is a must though. From first hand - I have 1 class with 11 functions, encompassing anything one would want from XSLT and in the simplest possible fasion. A relatively simple API, yet while making the tests (130 until now), I found some bugs, some of which I wasn't expecting. On top of that, while trying to fix some of them, I saw myself creating regressions. If the test suite was not there, I would have probably released yet another defficient release. With the new testing in place, I can bravely add up features I've wanted to add (a particular case in mind from few days back - support for SAXON9's options) without any fear of regressions.I too plan to create a CMS some day, though I don't have any plans for the near future on that one.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...