By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

Mixing Oil and Water ?? (PHP with UML & Unit Testing)

P: n/a
Hello,

I don't program full-time (anymore), but I do try and stay on-top of
the latest technologies and like most are always trying to upgrade my
skills and remain current (as much as is possible).

Most of my programming these days involves using PHP for creating
script files for automating tasks and procedures (locally), and also
for anything that might be needed by our divisional Intranet (not a
huge site by any stretch of the imagination).

Two topics that keep popping up at me are UML and Unit Testing, or
Test Driven Development (TDD).

Due to my current situation my time is somewhat restricted and limited
in scope -- and therefore I try and keep things relevant to what I am
working on, in this case it would be scripting with PHP. Therefore I
have a few questions:

1. Is UML often used when setting up web-sites (Intranet or
Internet), or more specifically web-based applications? If so, is it
applicable to using with PHP (or visa-versa).

From my limited understanding of things -- UML to me seems to be used
mostly for OOP programming and Objects, which doesn't really seem
useful for web-site & applications unless you are creating really
*large* and complex sites -- which of course I am not.

2. Like with UML, is Unit Testing or TDD applicable and appropriate
for PHP scripting or web-application development?

I do a lot of testing of smaller pieces of code (modules) in my
projects, but nothing to the extent or level that seems prevalent
(religious?) with Unit Testing. Again, like UML, Unit Testing seems
to me to work best when using OOP and objects, such as testing each
object separately (methods, properties) before assembling them
together into a project or application. However, if you do not use
objects, does Unit Testing still apply??

3. If any of the above do apply, can anyone suggest to me some
resources (ie: books, web-sites, articles, etc..) that would be
helpful, preferably with using PHP, but not limited too specifically.

I don't know if my questions are too vague, or too general. Basically
I always try and learn new things and these are two that seem to be
either popular, or just spark my interest. I don't mind spending time
learning something even if it is not 100% applicable to my situation
-- on the other hand, if there is something else out that would be
more so I would rather spend the time learning that instead.

Thanks so much.

Hugh
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hello,

On 10/27/2003 08:47 PM, Hugh Cowan wrote:
1. Is UML often used when setting up web-sites (Intranet or
Internet), or more specifically web-based applications? If so, is it
applicable to using with PHP (or visa-versa).

From my limited understanding of things -- UML to me seems to be used
mostly for OOP programming and Objects, which doesn't really seem
useful for web-site & applications unless you are creating really
*large* and complex sites -- which of course I am not.
AFAIK, the use of UML or OOP does not have to do the size of the sites.

For instance, any database driven project could have its data model
described with UML artifacts and you can use data object classes to
manage the storage of your application entities that you describe in the
model. You can do that even for sites with small number of entities in
your data model.
2. Like with UML, is Unit Testing or TDD applicable and appropriate
for PHP scripting or web-application development?

I do a lot of testing of smaller pieces of code (modules) in my
projects, but nothing to the extent or level that seems prevalent
(religious?) with Unit Testing. Again, like UML, Unit Testing seems
to me to work best when using OOP and objects, such as testing each
object separately (methods, properties) before assembling them
together into a project or application. However, if you do not use
objects, does Unit Testing still apply??
Of course. Tests help you make sure that each of the test project parts
work as intended, specially after you keep evolving your project. This
way you can prevent a lot of bugs that otherwise would go unnoticed.

3. If any of the above do apply, can anyone suggest to me some
resources (ie: books, web-sites, articles, etc..) that would be
helpful, preferably with using PHP, but not limited too specifically.

I don't know if my questions are too vague, or too general. Basically
I always try and learn new things and these are two that seem to be
either popular, or just spark my interest. I don't mind spending time
learning something even if it is not 100% applicable to my situation
-- on the other hand, if there is something else out that would be
more so I would rather spend the time learning that instead.


Since you explicitly say that you are limited in terms of time, you may
want to try Metastorage, which is a tool meant to let you design your
data model in a simple XML based format, and then it generates the
schema of the database to store your application entity data objects,
classes to store and retrieve those objects, forms to provide the user
interface to access those objects and even a class diagram in UML
notation with all generated classes.

All this gives you a head start to implement you application without
much less work and in much less time that you would take to write, test
and debug with the traditional (fully hand coded) programming methods.

You may obtain more information about Metastorage here:

http://www.meta-language.net/metastorage.html
--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #2

P: n/a
Manuel Lemos <ml****@acm.org> wrote in message news:<bn*************@ID-138275.news.uni-berlin.de>...

For instance, any database driven project could have its data model
described with UML artifacts and you can use data object classes to
manage the storage of your application entities that you describe in the
model. You can do that even for sites with small number of entities in
your data model.

Thanks for the info -- actually I spend almost all of my time working
with databases and manipulating data, so it's good to know. Just
about anything I add to the Intranet site deals with extracting some
data from the SQL Server and displaying it.

Since you explicitly say that you are limited in terms of time, you may
want to try Metastorage, which is a tool meant to let you design your
data model in a simple XML based format, and then it generates the
schema of the database to store your application entity data objects,
classes to store and retrieve those objects, forms to provide the user
interface to access those objects and even a class diagram in UML
notation with all generated classes.

I will certainly look up Metastorage. It's not that I don't mind
spending time learning something (by hand per'se). I don't currently
need either technology to complete my work so there is not a rush to
learn or implement -- I am just looking for something new to learn and
hoping that I can apply it one way or another to the work that I do in
the hopes that it will improve something (less time, better design,
fewer bugs, etc...)

Are there any PHP specific books or sites that you would recommend
looking at, or should I just stick with Metastorage for now?

Thanks again for your reply.

Hugh
Jul 17 '05 #3

P: n/a
Hello,

On 10/28/2003 02:40 PM, Hugh Cowan wrote:
Since you explicitly say that you are limited in terms of time, you may
want to try Metastorage, which is a tool meant to let you design your
data model in a simple XML based format, and then it generates the
schema of the database to store your application entity data objects,
classes to store and retrieve those objects, forms to provide the user
interface to access those objects and even a class diagram in UML
notation with all generated classes.
I will certainly look up Metastorage. It's not that I don't mind
spending time learning something (by hand per'se). I don't currently
need either technology to complete my work so there is not a rush to
learn or implement -- I am just looking for something new to learn and
hoping that I can apply it one way or another to the work that I do in
the hopes that it will improve something (less time, better design,
fewer bugs, etc...)


That is the spirit of Metastorage. :-)

Are there any PHP specific books or sites that you would recommend
looking at, or should I just stick with Metastorage for now?

As for Metastorage, despite the documentation is through, most people
prefer a quick start tutorial. So, I have been working on it lately. It
is not yet finished but the current version is available here:

http://groups.yahoo.com/group/metal-...s/metastorage/

Metastorage applies what is called a Model Driven Architecture (MDA for
short), that consists of building an application or parts of it from a
description of the Model. I am about to review a book about MDA soon. I
am just awaiting for it to arrive. It will be reviewed in these pages:

http://www.phpclasses.org/products.html

Just subscribed to the site to be notified when the reviaw is related.

Meanwhile you may want to take a look at this other book about code
generation. It tells you all about techiniques based on generators that
simplify the development of applications based on repetitive code. This
one of my favorite books I have read. The review is also here:

http://www.phpclasses.org/products.h...930110979.html


--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #4

P: n/a
Hugh Cowan wrote:
Hello,

I don't program full-time (anymore), but I do try and stay on-top of
the latest technologies and like most are always trying to upgrade my
skills and remain current (as much as is possible).

Most of my programming these days involves using PHP for creating
script files for automating tasks and procedures (locally), and also
for anything that might be needed by our divisional Intranet (not a
huge site by any stretch of the imagination).

Two topics that keep popping up at me are UML and Unit Testing, or
Test Driven Development (TDD).

Due to my current situation my time is somewhat restricted and limited
in scope -- and therefore I try and keep things relevant to what I am
working on, in this case it would be scripting with PHP. Therefore I
have a few questions:

1. Is UML often used when setting up web-sites (Intranet or
Internet), or more specifically web-based applications? If so, is it
applicable to using with PHP (or visa-versa).

UML is very broad so it is a very broad question. Regardless of
programming language (OO or otherwise), you can use UML such as use-case
diagrams, sequence diagrams etc. Obviously class diagrams are only
useful to PHP programmers who write object oriented apps.
From my limited understanding of things -- UML to me seems to be used
mostly for OOP programming and Objects, which doesn't really seem
useful for web-site & applications unless you are creating really
*large* and complex sites -- which of course I am not.

couldn't disagree more.
http://www.amazon.com/exec/obidos/tg.../-/0201730383/
2. Like with UML, is Unit Testing or TDD applicable and appropriate
for PHP scripting or web-application development?

absolutely, if that's the way you are used to working.
I do a lot of testing of smaller pieces of code (modules) in my
projects, but nothing to the extent or level that seems prevalent
(religious?) with Unit Testing.
don't be religious about software development. Use what provides good
outcomes for you.
Again, like UML, Unit Testing seems
to me to work best when using OOP and objects, such as testing each
object separately (methods, properties) before assembling them
together into a project or application. However, if you do not use
objects, does Unit Testing still apply??

good question. If you have no object, where are your units?
You would be doing "method" testing, treating a PHP script as though it
were an object and the globals were member properties (imported into
functions witht he GLOBAL directive). People who code procedurally are
probably more likely to hack up some other testing scheme. Not much
point trying to get existing unit-testing software to fit the bill.

it's a moot point.
3. If any of the above do apply, can anyone suggest to me some
resources (ie: books, web-sites, articles, etc..) that would be
helpful, preferably with using PHP, but not limited too specifically.


http://www.phppatterns.com/

http://www.sitepointforums.com/forum...hp?forumid=147
You'll find stimulating discussion on these topics here.

good luck and best wishes.
PS.
Why not check out an OO framework that I am building. It tries to
leverage a 100% OO design to promote code re-use, scalable,
"extendable", maintanable design. It also maximises the use of standards
for content and display separation without forcing you to use a
front-controller or a proprietary templating system.
http://xao-php.sourceforge.net/

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.