473,785 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript on the client as an alternative to Perl/PHP/Python on theserver

Hi all,

I've been writing Javascript for quite a while now and have, of late,
been writing quite a lot of AJAX and AJAX-related code.

In the main, my dynamically generated pages are created using Perl on
the backend, with Javascript providing limited frontend functionality.
As an example, an expanding tree would be fully populated on the
server-side and then presented to the browser, with Javascript and CSS
being used to vary the visibility of elements of the tree as required.

The critical point is that the page is "pre-built" on the server.

I've been thinking about an alternative approach, whereby the page is
built on the fly with various AJAX calls to the server to pull in the
necessary components. In the extreme, I could visualize doing away
with Perl generated pages entirely. All pages are HTML, with AJAX
calls to the server. The responding scripts would return JSON or XML
data which would be interpreted on the client side as required.

An advantage to this would be that it would be a lot easier to
generate the pages using simple HTML editors. It would be a lot
simpler to ensure validity of the HTML (as the final product would
always be available to me).

I understand that such an approach would mean that non-JS enabled
browsers would not be able to access the pages I create, but I'm not
concerned about that (my audience is internal to my company, so I can
stipulate browser requirements).

I'm interested in people's comments on this approach. Does it provide
extra burden on the server? Are there any hidden advantages or
disadvantages I may be aware of? Does anyone know of any white papers
on this approach?

Many thanks,

Dan
May 31 '08
22 2944
Dan Rumney wrote:
[snip]
>>It's abundantly clear that anyone using a UA that does not have
Javascript is not going to be able to access pages generated using the
model that I outlined in the original post.
They will if you properly design NOSCRIPT redirect and/or warning
blocks.

Good point. I was taking a limited view as to what 'access' was.
Certainly, they won't be able to gain anything fruitful from the
specific page that they've pointed their UA at. However, if I use a
NOSCRIPT element, I can ensure that they are informed as to the state
of the page and, ideally, directed to a page that provides comparable
functionality without the need for Javascript.
As a `noscript' element can only provide indirect redirection or not at all,
less experienced users will be annoyed at you forcing them to perform
another navigation step, while more experienced users will rightly call you
a script kiddie if you do this. Which is why I mentioned, but recommended
against, the better alternative of redirecting from a document that does not
require scripting to one that does instead of doing it vice-versa.

I strongly recommend not to listen to VK's recommendations for they have
been misleading in the past and there is no indication that this could ever
change.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Jun 1 '08 #21
Peter Michaux wrote:
On Jun 1, 11:31 am, Thomas 'PointedEars' Lahn <PointedE...@we b.dewrote:
>Peter Michaux wrote:
>>On Jun 1, 3:56 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
Peter Michaux wrote:
Over the past while one of my work projects has amounted to an
HTML page that essentially looks like this: <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"<html <head>
<title>on e-page client-side app</title<script src="library.js "
When one decides to publish information on the web only, one is
requiring a reader to have a computer,
For suitable values of "computer". Computers come in different forms
nowadays.
>>an internet connection
As much as it may surprise you, it is _not_ a necessity. Content can
be stored while the Internet connection is established and accessed
later offline.

So at some point an internet connection is required.
A network connection would be required at some point in most cases.
>>and web browser (or similar program to get content off the web).
I can accept that as an axiom of no greater value: You need a Web user
agent to access Web content.
>>That is setting the bar quite high
High for whom?

High for those without a computer, internet connection, and/or web
browser.
However, irrelevant to this discussion.
>>and expensive.
Not necessarily.

It certainly is expensive to own a computer, internet connection and web
browser. For some people going to a 10 peso/hour internet cafe in Mexico
is expensive.
It is not necessarily expensive for someone. Naming examples, public
libraries are providing inexpensive Internet access, too.

But talking about access costs for access now, you would deny the very
people that you talk above about the right to access to information if you
required them to have certain non-basic technologies available. Insofar
your "business constraints" argumentation is not only hypocritical but
proves to be contradictory in itself as you are excluding many potential
customers when following it. Have you ever thought about that?
>>If a publisher is willing to discard all potentially interested
readers that do not have an internet connection etc, then the publish
could subjectively decide that JavaScript is a requirement.
Which does not mean in any way that this decision is a reasonable one.

or an unreasonable one.
But your argument suggests it must be reasonable because of that, and I have
pointed out that this is dead wrong.
>>It has become quite clear over my time reading comp.lang.javas cript
that you believe you know the right way to do things
At least I can *justify* my design decisions.

As can I.
But you do not. Instead you are arguing with nebulous business constraints.
>>I think that is a naive approach to assessing other's subjective
decisions without knowing all there decision making constraints.
I do not need to know the constraints to show that a decision is not
well-founded.

Then, in my opinion, your decision making process is broken. You cannot
engineer something unless you know the requirements. To believe that
there is one solution for all situations is naive.
See below.
>>We have also seen over time that you are doing some things
objectively wrong like serving XHTML as HTML.
Your fallacies are getting tiresome.

http://groups.google.com/group/comp....e28a4ea7ec2903
Thanks, I know what I (have to) do. Yours is still a fallacy.
>>>>>I'm interested in people's comments on this approach.
It works.
It does not.
It absolutely does work for many users.
But not for as many if that path would not have been followed.

True. That may not be a net loss, however, when counting profit.
If one has blinded themselves enough.
>>>The document is empty.
That is not an argument about anything.
The value of the information in an empty document is zero and can
fulfill no purpose but to show that there is no information. I would
deem this to be a Bad Thing when the intent is to transport
information.

The intent may not be to transport information in a document-like format
even though that was the original intent of the web. The web is now being
used as an application platform as well.
Any software application transports information from the back end to the
user and vice-versa.
>>>For a user with disabilities,
There are other strategies for supporting disabled users other than
just a single page gracefully degrading. I'm sure you can think of at
least five other strategies off the top of your head.
Yes, I can. However, I can also see the drawbacks that follow from
them and do weigh them against the greater advantages that follow from
not implementing them.

Do you agree that given certain business constraints perhaps you would
weight the advantages and disadvantages differently?
Perhaps. However, it is seldom necessary to bow down to short-term business
arguments if you know enough to stand your ground and point out the
immediate, mid-term and long-term (financial) advantages of not entirely
following the logic those arguments are based on.
>>>a user behind a filtering proxy,
A business decision may be willing to sacrifice these users.
Which does not make this business decision a reasonable or economically
correct one.

It does not make it an incorrect one either.
It makes it an incorrect one if it is made to achieve short-term profit in
the face of mid-term or long-term losses.
>In fact, it makes it a rather dubious one

maybe or maybe not.
>if you consider that it is seldom the case that an Web application is
solely accessed from within a local area network.

A web application may be on the general internet with a notice it
requires CSS, image, JavaScript, Flash, Quicktime support etc.
Apples and oranges again.
These would all be reasonable requirements in some circumstances.
No, since HTML degrades gracefully by default, and server-side scripting is
readily available.
>>>a user with a not so sophisticated mobile device
Not all pages need to work on a mobile device.
I included "not so sophisticated" for a reason.

They don't need to work on not so sophisticated mobile devices.
Maybe now, since mobile Internet devices are only emerging.
>>As I've established above, a web page will require some describable
set of technologies to access it. It could be that for a particular
page the reader must have a modern desktop computer with a web
browser that has been released in the past year with all the bells
and whistles turned on.
True. However, since that particular "page" would introduce a barrier
that all the other content does not, one has to reconsider whether it
is reasonable that this is the case or if it would instead be better if
this barrier would not be introduced.

You certainly are correct for some situations. For others the "wow
factor" that JavaScript provides may be the only reason a user decides to
use a particular website when others exist without JavaScript or with
JavaScript as progressive enhancements. In this situation using
JavaScript heavily may be exactly the reason a site is profitable.
Short-term profit does not balance increased long-term maintenance costs,
for example.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Jun 1 '08 #22
On Jun 1, 2:03 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
Peter Michaux wrote:
On Jun 1, 11:31 am, Thomas 'PointedEars' Lahn <PointedE...@we b.dewrote:
Peter Michaux wrote:
On Jun 1, 3:56 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
Peter Michaux wrote:
Over the past while one of my work projects has amounted to an
HTML page that essentially looks like this: <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"<html <head>
<title>one-page client-side app</title<script src="library.js "
When one decides to publish information on the web only, one is
requiring a reader to have a computer,
For suitable values of "computer". Computers come in different forms
nowadays.
>an internet connection
As much as it may surprise you, it is _not_ a necessity. Content can
be stored while the Internet connection is established and accessed
later offline.
So at some point an internet connection is required.

A network connection would be required at some point in most cases.
>and web browser (or similar program to get content off the web).
I can accept that as an axiom of no greater value: You need a Web user
agent to access Web content.
>That is setting the bar quite high
High for whom?
High for those without a computer, internet connection, and/or web
browser.

However, irrelevant to this discussion.
I bring it up because of its complete relevance. The point is that a
lot of technology is required to view a static HTML page and, although
we routinely make a big fuss about it on c.l.js, it is only a tiny
step more to add JavaScript as a dependency. JavaScript as a
dependency is almost no barrier at all compared to the other
requirements.

[snip]
>It has become quite clear over my time reading comp.lang.javas cript
that you believe you know the right way to do things
At least I can *justify* my design decisions.
As can I.

But you do not. Instead you are arguing with nebulous business constraints.
If you cannot clearly see that business constraints play a role then
suppose you were charged with the task of writing interactive video
games for the web. The business partners want these to be usable by
people with a relatively low barrier. That is, no Flash or Sliverlight
or other browser plugins. You are allowed to assume support for HTML,
images, cookies, CSS and JavaScript because these are on by default in
most browsers. You must support IE6+, FF2+, O9+, S3+. How would you do
that so it degrades gracefully without JavaScript support?

[snip]
>>a user behind a filtering proxy,
A business decision may be willing to sacrifice these users.
Which does not make this business decision a reasonable or economically
correct one.
It does not make it an incorrect one either.

It makes it an incorrect one if it is made to achieve short-term profit in
the face of mid-term or long-term losses.
The way I read that is if your "if" clause does not hold then you are
admitting that sometimes it is ok or unavoidable to depend on
JavaScript.

[snip]

Peter
Jun 1 '08 #23

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

Similar topics

35
315
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created using Perl on the backend, with Javascript providing limited frontend functionality. As an example, an expanding tree would be fully populated on the server-side and then presented to the browser, with Javascript and CSS being used to vary the...
0
9645
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
10330
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...
0
10153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9952
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8976
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
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.