473,781 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Moving server side logic to javascript..

Hi Everyone,

I work for a financial company. I am planning to give a presentation
to rest of the development team (15 people) here on moving server side
logic to client-side javascript for an internal intranet application
rewrite. This approach will definitely stir up hot debate from
hardcore server-side Java folks who wants to do UI stuff even on the
server!. Since I am pretty much known as the JS or UI Guy of the
group, my Boss wants to hear the broad spectrum of PROs/CONs from each
proponent.

Personally, I think Javascript/Ruby is a more productive language than
Java.

My idea is simple. It is to convert most business logic to client-
side javascript and have calls to server-side code restricted to user
roles with data validation. Thats as simple as it gets.

Here are my list of arguments

1. True separation of UI logic from server-side data processing code
(no more server code spitting out client-side code)
2. Better user experience with faster response
3. The whole web 2.0 thing (no page refresh) :)
4. Offload client processing from server therefore reducing network
traffic (not really a strong argument is this?)

Keep in mind this is an internal app. Even if someone figures out the
JS logic behind the page and try to hack the app by posting to
Servlets, they will be restricted by their login role, and data
validation will take care of any bogus data being submitted.

Any feedback greatly appreciated to help this lonely UI guy!

-Pete

Feb 12 '07 #1
14 3570
<ra*******@gmai l.comwrote:
Hi Everyone,

I work for a financial company. I am planning to give a
presentation to rest of the development team (15 people)
here on moving server side logic to client-side javascript
for an internal intranet application rewrite.
This approach will definitely stir up hot debate from
hardcore server-side Java folks who wants to do UI stuff
even on the server!. Since I am pretty much known as the
JS or UI Guy of the group, my Boss wants to hear the broad
spectrum of PROs/CONs from each proponent.

Personally, I think Javascript/Ruby is a more productive
language than Java.
Well don't even mention that (particularly to your Java programmers) or
you will find yourself not being taken seriously at all.
My idea is simple. It is to convert most business logic to
client- side javascript and have calls to server-side code
restricted to user roles with data validation. Thats as
simple as it gets.
While (if they are any good) the server-side Java programmers will
already have the business logic in the form of re-useable components and
will question the cost of re-creating what already exists. Or they will
point out that if they implement new business logic they will be able to
easily re-use it later projects. Or they will point out that in order to
validate on the server they will still need most of the business logic on
the server so anything new will be being written twice.
Here are my list of arguments

1. True separation of UI logic from server-side data
processing code (no more server code spitting out
client-side code)
Didn't you just say you were planning on putting the business logic on
the client?

Putting all the user-interface code on the client makes sense (though it
is not always practical: consider sorting a table of 400,000 transactions
on the client. That is not going to happen).

Consider this 'separation' carefully. The thing to go for is a situation
where the server doesn't care about the specifics of the client (web
browser, desktop client, etc.) and the client doesn't care about the
technology running on the server (Java, ASP, .NET, Ruby, etc). That
separation would be about how the two communicated (SOAP (web services),
custom XML, JSON or whatever, and what messages/data they transmitted).
Pitch the separation at that point and you are building UI components for
a browser that can be used with any similar communication interface, and
the server code can provide the same interface to any client.
2. Better user experience with faster response
That doesn't necessarily follow, as the odds are client desktop machines
are of varying capability and include many that are not that new and not
necessarily due for an upgrade in the near future, while a brand new dual
or quad, mult-core CPU server with 4GB RAM and the latest hard disks
(with appropriate RAID spanning) can have the server side code flying,
organisation wide, for $4,000 or so (they really have got very cheep over
the last year or so).
3. The whole web 2.0 thing (no page refresh) :)
Buzzwords are not a reason for making strategic or architecturally
decisions.

If you mention it be ready to be asked precisely what "web 2.0" means,
and to be ridiculed if all you say is "no page refresh".

Have you any practical experience of designs where the page is never
refreshed? Odds are we are talking about Windows 2000 desktop machines
and so no opportunity to upgrade IE 6 to IE 7 (which is far better in
this respect) and so the need to put a great deal of work into not having
IE 6 gradually accumulate ever more of the client PC's memory, and
operate slower and slower as time goes on.
4. Offload client processing from server therefore reducing
network traffic (not really a strong argument is this?)
As I implied above, the need to offload work form the server is
diminishing, and modern networks can handle the traffic (particularly if
HTTP compression is employed).
Keep in mind this is an internal app. Even if someone figures
out the JS logic behind the page and try to hack the app by
posting to Servlets, they will be restricted by their login
role, and data validation will take care of any bogus data
being submitted.
So you will not be selling the server-side Java programmers on the idea
of them having less work to do, as they will have to repeat much of what
you do on the client in order to validate whatever is submitted.
Any feedback greatly appreciated to help this lonely UI guy!
I would have thought (and particularly in the context of a financial
institution, and for an internal application) the case to make would be a
financial one. The impact of potentially increased/decreased productivity
of the users of the system, with and against the cost/benefit of R&D,
design, implementation, ongoing maintenance, and their knock-on effects
for future projects.

Richard.

Feb 12 '07 #2
On Feb 12, 7:56 am, "rabbit...@gmai l.com" <rabbit...@gmai l.comwrote:
>
I work for a financial company. I am planning to give a presentation
to rest of the development team (15 people) here on moving server side
logic to client-side javascript for an internal intranet application
rewrite. This approach will definitely stir up hot debate from
hardcore server-side Java folks who wants to do UI stuff even on the
server!. Since I am pretty much known as the JS or UI Guy of the
group, my Boss wants to hear the broad spectrum of PROs/CONs from each
proponent.

Personally, I think Javascript/Ruby is a more productive language than
Java.

My idea is simple. It is to convert most business logic to client-
side javascript and have calls to server-side code restricted to user
roles with data validation. Thats as simple as it gets.

Here are my list of arguments

1. True separation of UI logic from server-side data processing code
(no more server code spitting out client-side code)
2. Better user experience with faster response
3. The whole web 2.0 thing (no page refresh) :)
4. Offload client processing from server therefore reducing network
traffic (not really a strong argument is this?)

Keep in mind this is an internal app. Even if someone figures out the
JS logic behind the page and try to hack the app by posting to
Servlets, they will be restricted by their login role, and data
validation will take care of any bogus data being submitted.

Any feedback greatly appreciated to help this lonely UI guy!
I agree with Richard. JavaScript may be more productive than Java but
not if the Java code already exists. Validation code should never
leave the server and so will need duplication.

However learning and implementing the JavaScript to do the things you
describe is still fun and interesting. There may be a way to speed up
parts of the application but the whole site (if it is a big one) as
one pages seems like overdoing a good thing.

The URLs of these one-page apps are are bookmarkable. The Yahoo! use
is good. The backbase use is probably not.

http://maps.yahoo.com/
http://www.backbase.com/

Here is an interesting client-side MVC architecture experiment (that
is buggy)

http://trimpath.com/project/wiki/SteveYen

Peter

Feb 12 '07 #3
VK
On Feb 12, 6:56 pm, "rabbit...@gmai l.com" <rabbit...@gmai l.comwrote:
Personally, I think Javascript/Ruby is a more productive language than Java.
I wouldn't put Javascript and Ruby on Rails as one _language_ unit.
Javascript is a language, Ruby is a language, Ruby on Rails is a known
Web framework, client-side dependant on Javascript.

On the client-side Javascript is indeed much more productive and
stable than Java applet.

It is also normally much cheaper in development: in my area for
instance for $35/h you are getting a happy experienced enough working
bee - when with Java it will cost you $55/h only for someone having
take a look on your needs and telling you how much it will really
cost ;-) Pretty much the same math remains for other client-side vs
server-side decisions. This math is actually the main behind reason of
the furious arguments every time a move like yours is approaching. So
be ready to all kind of arguments up to "the company will collapse"
and "God will have no mercy on you" :-)
My idea is simple. It is to convert most business logic to client-
side javascript and have calls to server-side code restricted to user
roles with data validation. Thats as simple as it gets.
OK
Here are my list of arguments

1. True separation of UI logic from server-side data processing code
(no more server code spitting out client-side code)
2. Better user experience with faster response
3. The whole web 2.0 thing (no page refresh) :)
4. Offload client processing from server therefore reducing network
traffic (not really a strong argument is this?)

Keep in mind this is an internal app. Even if someone figures out the
JS logic behind the page and try to hack the app by posting to
Servlets, they will be restricted by their login role, and data
validation will take care of any bogus data being submitted.

Any feedback greatly appreciated to help this lonely UI guy!
A good objective, clear arguments.

Client-side solution imposes client-side scripting enabled - at least
for the given domain. If you need to support IE prior 7.0 for AJAX
solutions it also implies ActiveX support enabled - at least for the
given domain. Check with administrator that the settings are correct -
or can be corrected - for all involved machine.

This is the only technical consideration coming into my mind right
away.

Feb 12 '07 #4
Thank you for all the wonderful suggestion and feedback.

With the web 2.0 buzz, my boss has definitely bought into the user
experience thing (drag/drop, type-ahead completion). He has already
sold ideas of better apps to other department stakeholders.

To build more of these Ajax style applications going forward, I think
its necessary to have "clean" and "separated" layers of client browser
code and server code.

I think MVC is really a big cloud of confusion in implementation.
Here is my recommended architecture:

Client Code handles:
Server Code
Business logic on the client-side will be duplicated, but since this
is a rewrite of an old year 2000 app with messy JSPs various .
Feb 12 '07 #5
Oooops hit wrong button...

Thank you for all the wonderful suggestion and feedback.

With the web 2.0 buzz, my boss has definitely bought into the user
experience thing (drag/drop, type-ahead completion). He has already
sold ideas of better apps to other department stakeholders.
To build more of these Ajax style applications going forward, I think
its necessary to have "clean" and "separated" layers of client
browser
code and server code.
I think MVC is really a big cloud of confusion in implementation. I
believe the controller is the user. After all, he/she is the one
pushing the buttons and clicking links.
Here is my recommended architecture:
1) VIEW and CONTROLLER handled by client code.
- UI patterns
- html form backed with business logic
- navigation

2) The MODEL is handled by server side code.
- data access api via URLs for example:
- /AddRecord
- /UpdateRecord
- /RemoveRecord
- /ListRecords

3) All client and server communication via JSON strings (XML is too
heavy and fat).
Main Benefits:

1. The cool thing here is that the server developer is only focused on
writing model code, data connections, data validation and integrity,
and services.
2. Server code doesn't break front-end because server code does not
have embedded JS code.
3. Server developer can work independently from client developer!!

Pete



Feb 12 '07 #6
Putting all the user-interface code on the client makes sense (though it
is not always practical: consider sorting a table of 400,000 transactions
on the client. That is not going to happen).
It would not be good interface design to display 400K rows. Part of a
good UI design is the presentation of relevant content in summarized
format to easily assist in making decisions, or provide a simple
facility to find records within a 400K table easily (think record
filter over a paged table).

and yes JS has its limitations speedwise being 50 times slower than
compiled Java.

Feb 12 '07 #7
VK
On Feb 12, 10:46 pm, "rabbit...@gmai l.com" <rabbit...@gmai l.com>
wrote:
I think MVC is really a big cloud of confusion in implementation.
Indeed: because majorly it remains a subject of pleaseful talks for
boss. When it comes to an actual implementation, many teams just fall
back to a twisted around server-client schema which they used to:
where global javascript context becomes "server" and page controls and
display areas become "clients". The most ugly sample of this practice
remains IXMLHTTPRequest (XMLHttpRequest later). It was brute force
pulled out from the Microsoft data binding concept - to be used as
some kind of stay-alone internal browser to manually pull data from
the server and to manually destribute it by "clients" (control and
display areas on the page). It took well two years to come back to
semi-normal usage - and still long way to go.
Client Code handles:
In terms of MVC not a client code but user interface elements. They
implement this or that logic - behavior and they delegate a part of
logic to the server-side data processor.

Feb 12 '07 #8
<ra*******@gmai l.comwrote:
>Putting all the user-interface code on the client makes sense
(though it is not always practical: consider sorting a table
of 400,000 transactions on the client. That is not going to happen).

It would not be good interface design to display 400K rows.
<snip>

No, it would be insane. But if the user is looking at Jan 2nd to Feb 23rd
sorted by date and decides they want to switch to viewing the table
sorted by credit balance you can only make that switch on the client if
you do have all 400k recodes on the client (or fetch the rest at that
point), which means you cannot contemplate doing that on the client at
all.

Richard.

Feb 12 '07 #9
"VK" <sc**********@y ahoo.comwrote:
On Feb 12, 6:56 pm, <ra*******@gmai l.comwrote:
<snip>
It is also normally much cheaper in development: in my area
for instance for $35/h you are getting a happy experienced
enough working bee - when with Java it will cost you $55/h
only for someone having take a look on your needs and telling
you how much it will really cost ;-) Pretty much the same math
remains for other client-side vs server-side decisions.
<snip>

LOL. Coming from the person who wrote:-

<URL:
http://groups.google.com/group/comp....20fbcd4b4ab7f8
>
-and:-

<URL:
http://groups.google.com/group/comp....869add6d8dfcad
>
- paying an extra $20/h to get someone who can do some analysis and write
code that isn't full of holes is going to be the cheaper option in the
long run. (Pay peanuts; get monkeys.)

Richard.

Feb 12 '07 #10

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

Similar topics

4
10147
by: usl2222 | last post by:
Hi folks, I appreciate any assistance in the following problem: I have a form with a bunch of dynamic controls on it. All the controls are dynamically generated on a server, including all the validators. The user enters the data, presses OK. My OK button is dynamically generated as well, with some code-behind logic in
0
1015
by: Shaul Feldman | last post by:
Hello, I'm trying to find a way to add data (not working with DB) from client-side to server side. Let's say I have a form (page) that a user may add rows (in table) with data. the data is NOT coming from DB. What would be the solution if possible at all? This means that server has to re-learn each time (every post) what row with content has been added/deleted/edited. Thank you a lot. (In case there maybe some solution on the web,...
3
3538
by: The Developer | last post by:
Hi All, I have a web application where I am adding a custom attribute to my ASP.NET text box control and changing value of that attribute at client side using JavaScript. My problem is that changed value of that custom attribute is not reflecting back at server side. Any ideas about this problem? Server side code: private void Page_Load(object sender, EventArgs e) { if (this.IsPostBack == false)
2
3795
by: Simon Matthews | last post by:
I have an asp.net application written in c# and in many cases when the user submits a form or causes a postback there could be significant processing (logic) required which results in a message being displayed to the user. After processing server side I register a script with the clientside to use alert('message'); to display the user message. The problem I have is that this message will show again if the user leaves the page and...
10
2052
by: Ben | last post by:
Hi, I made an application in classic asp (reservation of books and video stuffs for students) and want to migrate to asp.net. The user has to chose a date, then pushung on a submit button. The whole day is then displayed in cels of a table. The user has then to click in a cel representing a hour of the day and an object (book ..), and finally click on the submit button to insert that reservation in the database. My problem is: there...
4
1252
by: Paul | last post by:
Hi all, I have a page with a mutli view control where one of the views needs to contain a separate HTML get form with a submit button that goes to another page. In ASP this was no problem - there was no container form and it just went to the target page. In ASP .NET however, there is a container form and having an embedded form breaks the page. Adding another server-side form just gets the "A page can have only one server-side Form tag"...
6
2528
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without a button click event? Question 2: How do you get response from a Confirm() popup window to uncheck all server-side checkboxes placed in a panle of a web user control? I am using ASP.Net 2.0, Thanks. Need info...
5
1370
by: Peter Michaux | last post by:
Hi, I might be turning a corner today and seeing the light. I might still be confused :) If JavaScript is the language for the browser then why do servers use Ruby/Rails, Perl/Catalyst, Python/Turbogears or PHP/Cake? Is it because the prototype-based language is too different to be chosen except when necessary. Is it because browser bugs make people think JavaScript is bad? Is JavaScript not suitable for the server-side for any reason?
5
4475
by: Mike P | last post by:
How would I show or hide a div that is using client side Javascript based upon a server side variable? Here are my divs : <div id="idButton5" class="otherLeftBarLink" onmouseover="javascript: changeStylesMouseOver('5');" onmouseout="javascript: changeStylesMouseOut('5');" onclick="location='/AddProject.aspx'"> <div class="leftBarLinkText"> Add Project
0
9474
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
10308
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
10143
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...
1
10076
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
6729
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
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
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
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
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.