473,769 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2910
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
"informatio n" 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 "interprete d" 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 "applicatio n" - what gets presented to the browser.

M.
Jan 21 '06 #5

"neodem" <no******@neode m.com> wrote in message
news:qK******** ************@co mcast.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******** *************@o 13g2000cwo.goog legroups.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...tradi tional") you'll have
some indigestion.


--
PETER FOX Not the same since the cardboard box company folded
pe******@eminen t.demon.co.uk.n ot.this.bit.no. html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.dem on.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

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

Similar topics

2
1909
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 browsed the Google archives and seen this question pop up a few times before but never with any particulary good answers. For some reason this doesn't seem like a hot topic. I am not talking about the product information, that is already stored...
0
4248
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 Applications and owner of Access Microsystems. Doug can be reached at doug@accessmicrosystems.com. --------------------------------------------------------------------------------
5
3198
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. 1. I can create a common module like common.vb in my project and put all the functions in there. 2. Create a utility class and create the common functions as shared
2
5782
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 the components. Anyway, the data to be analyzed comes in Excel format, and needs to be converted into SQL Server in some way or another, And I'm not sure which is the best way. I find lots of info on how to pull data from SQL Server and present...
3
2100
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 on the other side the service reads messages for these clients from MSMQ and sends them to already connected clients. the clients can also send information back to the "HUB" which will be parsed and sent to MSMQ. when the clients connect to this...
20
6641
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 logging onto the web server using LDAP for authentication, do most people 1) have the web server connecting to the database using its own user account (possibly through ident), and controlling access to different database entities strictly through...
4
2630
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 simplest example of my situation (real world would be more complex). Say you have two versions of your application. A release version and a development version. After a month of developing you are ready to release a new version. There have...
3
1367
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 code fromother programmers I feel like I am so far behind. I see them usingstuff like Interfaces, IEnumerables, StringBuilders, etc. I have written several applications in C# since I started, but I don't ever seem to need or use those more...
9
1707
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 of the three options: 1. Use one instance of XmlDocument thought the whole Application by initializing the class in Global.asax in the Application_Start Event. 2. Use one instance per session using the Session_Start Event. 3. Create and...
7
1625
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 of exe/dll should I develop in Visual C++ so that I can meet these requirements 1) No administrator rights are required
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.