473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Is PHP the best way to create a web application?

PHP, and to a lesser degree JSF has become very popular ways to build web
applications. What I don't understand, and what I would like you all to
comment on, is how these methods are the best way to build web applications.
I come from the traditional Struts/JAVA world and the traditional MVC
archetecture. It seems to me, and I could be wrong, that PHP and JSF seem to
be pulling more business and data layer code up to the View Layer. I don't
see how this is a good thing. Wouldn't it be better to use the traditional
method and keep the code out of the view? How does one maintain the code? It
will be scattered across web source code (PHP pages, etc.)... The coupling
would seem to be really high and that can't be a good thing for reusue..

Can someone give me an idea of where I am wrong?
Jan 21 '06 #1
12 2879
Hello neodem,
PHP, and to a lesser degree JSF has become very popular ways to build
web applications. What I don't understand, and what I would like you
all to comment on, is how these methods are the best way to build web
applications. I come from the traditional Struts/JAVA world and the
traditional MVC archetecture. It seems to me, and I could be wrong,
that PHP and JSF seem to be pulling more business and data layer code
up to the View Layer. I don't see how this is a good thing. Wouldn't
it be better to use the traditional method and keep the code out of
the view? How does one maintain the code? It will be scattered across
web source code (PHP pages, etc.)... The coupling would seem to be
really high and that can't be a good thing for reusue..

PHP is great for simple stuff, but if you want to write a hairy, complex
web app, I'd go with RubyOnRails or Seaside.
See http://www.vanderburg.org/Blog/2003/...ges/wrong_turn
Jan 21 '06 #2
neodem wrote:
It seems to me, and I could be wrong, that PHP and JSF seem to
be pulling more business and data layer code up to the View Layer. I don't
see how this is a good thing.
That's true to some extent. In web development many things don't settle
naturally into separate layers. Page navigation, for example, impacts
both business logic and presentation. By tradition and structure, PHP
does steer people towards having an expanded presentation layer. I
think this just reflects the reality of web development: Presentation
is very important, more so than in traditional applications. If your
web site is ugly or hard to navigate, visitors will go elsewhere.
Wouldn't it be better to use the traditional
method and keep the code out of the view? How does one maintain the code? It
will be scattered across web source code (PHP pages, etc.)... The coupling
would seem to be really high and that can't be a good thing for reusue..


Embedding code in HTML actually makes a lot of sense if you rethink
what an HTML page is. Instead of a static document, think of it as a
list of commands directing the browser to do certain things. When you
insert a block of PHP of code in its midst, you're just coding in a
different language. The place of execution might be different, but the
purpose is the same: to display something at the particular area of the
page. Viewed this way, code embedding is a way to consolidate code with
related visual impacts at one location.

Jan 21 '06 #3
NC
neodem wrote:

PHP, and to a lesser degree JSF has become very popular ways
to build web applications. What I don't understand, and what I
would like you all to comment on, is how these methods are the
best way to build web applications.
There is no such thing as "the best way to build Web applications".
Rather, you must think of the "most appropriate" way, given the
applicaiton's level of complexity, preferences regarding the operating
system and database back-end, development time and cost considerations,
and, perhaps, availability of a foundation product (i.e., a third-party
product that can be quickly extended to required functional
specifications).
I come from the traditional Struts/JAVA world and the traditional
MVC archetecture. It seems to me, and I could be wrong, that
PHP and JSF seem to be pulling more business and data layer
code up to the View Layer. I don't see how this is a good thing.
Very simple. It's faster to develop from scratch. Also, not everyone
is convinced that OOP is such a good idea. Once you realize that you
need not be shackled by OOP and can go back to good old procedural
programming any time you want, adherence to any object-oriented
architecture becomes a moot point.
Wouldn't it be better to use the traditional method and keep the
code out of the view? How does one maintain the code?
You are assuming that code needs to be maintained, which is not always
the case. Think of rapid prototyping, for example; you want to build
the prototype quickly, knowing full well that (1) there is no guarantee
that the application will evolve past the prototype, and (2) if the
application does in fact evolve past the prototype, there is no
guarantee that the production version will be written in the same
language the prototype was. In this case, the use of a framework will
only add to the cost of prototyping...
Can someone give me an idea of where I am wrong?


On two counts: (1) OOP is not the only way to program in PHP, and (2)
not every application is meant to be maintained.

Cheers,
NC

Jan 21 '06 #4
neodem wrote:
PHP, and to a lesser degree JSF has become very popular ways to build web
applications. What I don't understand, and what I would like you all to
comment on, is how these methods are the best way to build web applications.
I come from the traditional Struts/JAVA world and the traditional MVC
archetecture. It seems to me, and I could be wrong, that PHP and JSF seem to
be pulling more business and data layer code up to the View Layer. I don't
Let's see. user clicks on link A that starts Jave -> sends
"information" to browser (or downloads and executes in a Java machine ON
THE CLIENT". Data is sent back to original server and is processed ,
then more stuff presented to the client.

User clicks on link B. sends data to server, server processes data, send
results back to browser.

Not much different. On is/can be a compiled executable (JAR file etc.)
and the other is "interpreted" at run time.

in the "compiled" executable, you can have many different
modules/classes that accomplish business rules, database connectivity,
transactional integrity and presentation.

In PHP, JSF you have essentially the same thing, they may be
contained/segmented in seperate "include" files, but they are there just
the same.

Same thing goes for compiled CGI-type applications. In fact there can
be many module files that get created, compiled and linked to the "main"
program.

Bottom line is that they all do the same thing.
see how this is a good thing. Wouldn't it be better to use the traditional
method and keep the code out of the view? How does one maintain the code? It
will be scattered across web source code (PHP pages, etc.)... The coupling
would seem to be really high and that can't be a good thing for reusue..

Can someone give me an idea of where I am wrong?


PHP code is not "viewable" in the browser and if done correctly, neither
are the business "modules".

With either Java, JSF or HTML/PHP, Your business logic is contained in a
language that transmits it's results to the browser. If you are
taking about using Java Scripting, then yes, those rules move to the
viewable side of the "application" - what gets presented to the browser.

M.
Jan 21 '06 #5

"neodem" <no******@neodem.com> wrote in message
news:qK********************@comcast.com...
PHP, and to a lesser degree JSF has become very popular ways to build web
applications. What I don't understand, and what I would like you all to
comment on, is how these methods are the best way to build web
applications. I come from the traditional Struts/JAVA world and the
traditional MVC archetecture. It seems to me, and I could be wrong, that
PHP and JSF seem to be pulling more business and data layer code up to the
View Layer. I don't see how this is a good thing. Wouldn't it be better to
use the traditional method and keep the code out of the view? How does one
maintain the code? It will be scattered across web source code (PHP pages,
etc.)... The coupling would seem to be really high and that can't be a
good thing for reusue..

Can someone give me an idea of where I am wrong?


The language is irrelevant, it's how you use it that matters. Saying that
PHP prevents you from writing layered applications is total rubbish. If you
want reusable code, then you have to write it. It doesn't come for free. If
you are a competent programmer you can progress from single tier into
2-tier, 3-tier or even N-tier. How do I know? Because I've done it.

Tony Marston
http://www.tonymarston.net
Jan 21 '06 #6
Ok.. but let me ask you this.. What if you were building a real application,
not a prototype. I'm talking about a real enterprise application. In that
case you need to have unit tests and integration tests and you need to be
able to change and adapt the application as it evolves.. or perhaps this is
a commercial web app that needs to be customised for different clients. I
can't see how having all the code wrapped up in the pages makes any sense at
all. It's scripting and to me scripting is akin to hacking.. It's wonderful
if you are building a simple web app for your girlfriend to keep track of
her recipies but it begins to fall apart when you are building scalable,
maintainable, professional applications no?
"NC" <nc@iname.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
neodem wrote:

PHP, and to a lesser degree JSF has become very popular ways
to build web applications. What I don't understand, and what I
would like you all to comment on, is how these methods are the
best way to build web applications.


There is no such thing as "the best way to build Web applications".
Rather, you must think of the "most appropriate" way, given the
applicaiton's level of complexity, preferences regarding the operating
system and database back-end, development time and cost considerations,
and, perhaps, availability of a foundation product (i.e., a third-party
product that can be quickly extended to required functional
specifications).
I come from the traditional Struts/JAVA world and the traditional
MVC archetecture. It seems to me, and I could be wrong, that
PHP and JSF seem to be pulling more business and data layer
code up to the View Layer. I don't see how this is a good thing.


Very simple. It's faster to develop from scratch. Also, not everyone
is convinced that OOP is such a good idea. Once you realize that you
need not be shackled by OOP and can go back to good old procedural
programming any time you want, adherence to any object-oriented
architecture becomes a moot point.
Wouldn't it be better to use the traditional method and keep the
code out of the view? How does one maintain the code?


You are assuming that code needs to be maintained, which is not always
the case. Think of rapid prototyping, for example; you want to build
the prototype quickly, knowing full well that (1) there is no guarantee
that the application will evolve past the prototype, and (2) if the
application does in fact evolve past the prototype, there is no
guarantee that the production version will be written in the same
language the prototype was. In this case, the use of a framework will
only add to the cost of prototyping...
Can someone give me an idea of where I am wrong?


On two counts: (1) OOP is not the only way to program in PHP, and (2)
not every application is meant to be maintained.

Cheers,
NC

Jan 22 '06 #7
On Sat, 21 Jan 2006 12:33:08 -0500, neodem wrote:
PHP, and to a lesser degree JSF has become very popular ways to build web
applications. What I don't understand, and what I would like you all to
comment on, is how these methods are the best way to build web applications.


There is no such thing as "the best way to build an application".
My comment on all the rest is "42". All your base are belong to us.

--
http://www.mgogala.com

Jan 22 '06 #8
Following on from neodem's message. . .
PHP, and to a lesser degree JSF has become very popular ways to build web
applications. What I don't understand, and what I would like you all to
comment on, is how these methods are the best way to build web applications.
I come from the traditional Struts/JAVA world and the traditional MVC
archetecture. It seems to me, and I could be wrong, that PHP and JSF seem to
be pulling more business and data layer code up to the View Layer. I don't
see how this is a good thing. Wouldn't it be better to use the traditional
method and keep the code out of the view? How does one maintain the code? It
will be scattered across web source code (PHP pages, etc.)... The coupling
would seem to be really high and that can't be a good thing for reusue.. Yeah. The whole thing's rubbish. I shouldn't tell you this but you can
write "Hello world" without a single include, base class, foundation
widget, and (so it's rumoured but don't quote me) no objects or even an
interface.
Can someone give me an idea of where I am wrong?

Actually : "It works".

There's plenty of freedom for poor programmers to make poor applications
but that isn't a crime.

Of course if you've swallowed a whole programming encyclopaedia mixed
with useless value judgements (eg "better...traditional") you'll have
some indigestion.


--
PETER FOX Not the same since the cardboard box company folded
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Jan 22 '06 #9
> Ok.. but let me ask you this.. What if you were building a real application,
not a prototype. I'm talking about a real enterprise application. In that
case you need to have unit tests and integration tests and you need to be
able to change and adapt the application as it evolves..
That is exactly how I write my web applications. Both in PHP and Visual
Basic .NET. Being able to adapt an application is usually dependent on a
good design. You can make good and bad designs in all programming
languages. You can write unit tests in all programming languages. I
ported my own unit test framework to both VB .NET and PHP.

If you want or if you don't know better, it is perfectly possible to
write a relative small application in Ruby On Rails that is beyond
maintenance. Ruby On Rails facilitates good programming practice, but
you have to enforce it yourself.
or perhaps this is
a commercial web app that needs to be customised for different clients. I
can't see how having all the code wrapped up in the pages makes any sense at
all. It's scripting and to me scripting is akin to hacking..


Say what? That is how web pages are organized. You type a URL, and
there's a program that starts running. No difference between ASP, ASP
..NET or PHP here. If you mean you don't like you can mix HTML and PHP
code (like in ASP), there is nobody that will force you. In fact, most
PHP pages I have written have no HTML, but can generate it. It is also
perfectly normal to write included PHP code libraries, like the source
files in VB .NET. You can define more than one class in a file, but it
is up to you to use that or not.

Frankly, I don't know the difference between a programming language and
a script. I started my programming carreer as an AutoLisp programmer,
and AutoLisp was always called a programming language, even if it serves
just to "drive" autocad. And you can drive about anything from JavaScript.
Serious, BOTH scripts and programming languages have evolved. I have
written scripts to connect a text editor to a database or source code
control. Those scripts are large enough to use regular object oriented
programming. Scripting is not the same as hacking. You can hack in C,
just like you can program neatly in VBScript. And the other way around.

Best regards
Jan 22 '06 #10
neodem wrote:
Ok.. but let me ask you this.. What if you were building a real <snip> I can't see how having all the code
wrapped up in the pages makes any sense at all.
I find it makes life a lot simpler when there is a direct correlation
between the URL and the underlying source code - although it *is* possible
to write front-controller type sites in PHP (just unnecessary). It also
makes things like partitioning a shared system and memory management *much*
simpler.

Bruce Perens recently criticized PHP for being 'too easy' - certainly not an
accusation that could be made of Java web applications. Because it's easy
use, easy to manage and relatively secure are (IMHO) the reason that PHP is
widely available - how often do you see managed J2EE packages. But the flip
side of this is that there _is_ a lot of badly written PHP code out there.
I do believe that PHP is at least as viable a tool as Java for large scale
application development and significantly better than Perl (well, there a
flame war brewing here anyway).
It's scripting and to me
scripting is akin to hacking..
I guess you don't have much experience with Unix systems. A surprising
amount of the configuration management is done by (usually Bourne) shell
scripts. Also 'scripting' is a rather archaic and arbitary term these days.
It's certainly true that PHP can act as application glue - I quite like the
fact that I can integrate a Prolog program with a SQL database, produce
output using GraphViz using PHP to bind it all together. Certainly,
historically, the languages that were used for such purposes did not lend
themselves to building large applications (many did not support modules or
provided more than the most basic arithmetic fns) that is no longer the
case. Indeed the mere fact that a language is capable of trivial uses
without significant effort and expertise does not correspond to ineptitude
for large applications.
It's wonderful if you are building a simple
web app for your girlfriend to keep track of her recipies but it begins to
fall apart when you are building scalable, maintainable, professional
applications no?

<snip>
You are assuming that code needs to be maintained,


I'll admit that I don't know JSF, but if anything, I think PHP has the
advantage over J2EE for maintainability. I find the error handling much
easier (I mean - checked exceptions.....WTF!). Problem resolution is much
simpler without having a server build. Not to mention inserting
instrumentation into live systems.

(I think I should stop feeding the troll now)

C.
Jan 22 '06 #11

Dikkie Dik wrote:
That is exactly how I write my web applications. Both in PHP and Visual
Basic .NET. Being able to adapt an application is usually dependent on a
good design. You can make good and bad designs in all programming
languages. You can write unit tests in all programming languages. I
ported my own unit test framework to both VB .NET and PHP.


Well, everyone aspires to create a good design. I don't there are
programmers who set out to make a poor design. Often times it just
isn't possible to come up with a good design on the very first attempt.
It could be that you failed to comprehend the entire scope of the
application. It could be there were unanticipated technical roadblocks.
It could simply be that the requirements had suddenly changed. A more
pertinent question I think is how quickly one can recover when a design
decision turns out to be a mistake. The flexibility of PHP is a real
advantage here.

Jan 23 '06 #12
Chung Leong wrote:
Dikkie Dik wrote:
That is exactly how I write my web applications. Both in PHP and Visual
Basic .NET. Being able to adapt an application is usually dependent on a
good design. You can make good and bad designs in all programming
languages. You can write unit tests in all programming languages. I
ported my own unit test framework to both VB .NET and PHP.

Well, everyone aspires to create a good design. I don't there are
programmers who set out to make a poor design. Often times it just
isn't possible to come up with a good design on the very first attempt.
It could be that you failed to comprehend the entire scope of the
application. It could be there were unanticipated technical roadblocks.
It could simply be that the requirements had suddenly changed. A more
pertinent question I think is how quickly one can recover when a design
decision turns out to be a mistake. The flexibility of PHP is a real
advantage here.


It could simply be that the requirements had suddenly changed.


Bingo! I have yet to be on a project which takes more than 3 hours
where the requirements haven't changed someplace along the line! :-)
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jan 23 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tim | last post by:
I am doing a small asp webshop and want to make it atleast bi-lingual. I have thought of a few ways to do this but would like to have a second opinion on what you think is the best way. I have...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
5
by: wrecker | last post by:
Hi all, I have a few common methods that I need to use at different points in my web application. I'm wondering where the best place would be to put these? I think that I have three options. ...
2
by: Trond Hindenes | last post by:
Hello all, I am working on a application for analyzing data from a SQL Server Database using vb.net. THe application will mostly be web-based, although we migt use some Windows Forms for some of...
3
by: danavni | last post by:
i need to build a service that will accept incoming TCP/IP connections. the service should act like a "HUB" where on one side clients connect to it and stay connected for as long as they like and...
20
by: Keith G. Murphy | last post by:
I'm trying to get a feel for what most people are doing or consider best practice. Given a mod_perl application talking to a PostgreSQL database on the same host, where different users are...
4
by: Collin Peters | last post by:
I have searched the Internet... but haven't found much relating to this. I am wondering on what the best practices are for migrating a developmemnt database to a release database. Here is the...
3
by: =?Utf-8?B?TWljaGFlbA==?= | last post by:
Hi, I have been developing using C# in ASP.Net for about a year now. And have been a programmer for about 10 years. I have learned many different things in .NET, but still when I look at sample...
9
by: Yehia A.Salam | last post by:
Hello, I am building an ASP.net website that connects to an XML database, and was wondering which is the best way to create the connection if I need frequent access to the database, I have one...
7
by: Ashutosh Bhawasinka | last post by:
Hi, I have a C# .Net application which needs to use some feature which can be only developed in Visual C++ (its extended MAPI). The C# exe will be supplied to users without a setup. What kind...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.