With HTML5, JavaScript and AJAX, are PHP, ASP.NET and J2EE backends still required? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to catch up with modern Web application design approaches. With the latest technologies, is it still appropriate or necessary to tie a web application to a specific backend language like PHP, ASP.NET or J2EE?
I've been thinking of HTML5, JavaScript and asynchronous queries. An application could potentially consist of a series of simple, empty HTML document templates where the data components are filled in after the page load event using JQuery/XMLHttpRequest calls to a web service.
In this context, the backend web service could be implemented using any arbitrary framework and the serving of HTML pages could be handle by any web server. The application's web component would then be purely HTML5 and JavaScript with all other business logic hidden behind a web service interface.
But is this an effective design for complex applications which rely on session management and page transitions? Does anyone code this way or are traditional backend languages always used to generate the HTML documents?
Thanks.

Interesting question, I view it as this way. HTML5 is no longer HTML5.. but "HTML". We'll never see an HTML6, the new HTML5 model will continue to be improved upon and have features added to it. Some day, the days of needing third party plugins for video, audio and drawing, all devices will share the same front end presentation model.
When you think of it, frameworks like PHP just make dynamic HTML, and marry business logic with presentation logic. For the forseeable future, couldn't we always have a need for something like that? That being said, I can certainly see numerous applications in the future that leverage open data and rich client side controls. I don't think this threatens the extinction of ASP.NET, PHP or J2EE.. I think it enhances them, as now we all have a more fuller toolbox to develop with.
Scott Hanselman gave an awesome presentation 2 years ago at Microsoft's Build conference (http://channel9.msdn.com/Events/Build/2012/3-027), it's a great discussion on how JavaScript makes the web browser an incredible emulator, and that you can now front load logic and programming onto the end user... similar to what you are thinking. In the end, I think options like this just allow us to make sure that we use the tools for the appropriate reasons, just like in the ASP.NET world we now have Web Forms and MVC.. Web Forms aren't dead, they're just not the only game in town anymore, but now we can use Web Forms when appropriate, and MVC when appropriate.
Great question!

Related

Convert a Qt C++ application to a web app [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I wrote an application which connects to a MySQL database and queries/adds/deletes data in Qt Framework. I want to convert to a web application run inside a browser. I have some experience in PHP and I could code the whole app in it, but I have a problem: I would be forced to reload the page every time when I want to do something with the database. I want to make something like Facebook/GMail/Facebook Messenger where accessing a database is achieved without reloading the whole page. This is the part which I never done before.
I have some questions about this:
What are the JavaScript libraries out there which I could use?
What is the appropriate way to do this: create a backend which is between the web app and the database, or connect to the database directly?
I don't necessarily need to stick to that languages, I'm open to new technologies, programming languages.
Edit:
Based on suggestions and my own research I found two technologies which I think I could use: AJAX and PHP(thanks to Hugo Dias) or NodeJS. I didn't wrote any code yet, so which of them would be better for my app? A little more information: this app will used by only the small number of users at the same time, like max 10.
You need to use a web server, for eg. Apache Tomcat. If you want to keep your code in c++, you could convert it into a CGI. Otherwise, you can use java servlets or JSP along with JDBC. You can set it up so that when a button is clicked the CGI script is triggered and the database queries are run.
Short answer:
Yes,there are libraries that helps you with that.
JQuery and PrototypeJS are some of them.
There are some ways of do this, but in any way,you need of a Backend. It's inherent in architecture of Web(Client-Server).
Long answer:
Yes,there are ways of do that. What you're looking for is called AJAX(and stands for Asynchronous JavaScript and XML).
AJAX is a technics that gathers some technologies like XHR and Javascript, mainly.
It allows you work with asynchronous requests,what basically lets you update your page without reload it.
You'll find extensive documentation here about it,and here a simple example with PHP.
The architecture of App is of your choice. Under the Client-Server architecture,you can apply what is best for you,since a monolithic system until a MVC or MVVM pattern.

MVC without framework? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Now I don't have any specific question, rather a general, ask for opinions post.
Within a month we will receive the documentation of a project we have to develop. The website has a lot of potential and will be advertised in TV and radio as well when it'll be done. So it'll have a lot of visitors, members and it'll have a rich admin panel with lots of options. My friend who was asked to be the CTO is a senior PHP developer with almost 10 years of experience and I am a junior JS developer. (or less, I don't have years of experiences in JS, but I'm committed)
Is a JS MVC framework substitute for PHP? Is a PHP MVC framework substitute for JS? Are they both working well together or is it possible to not use any framework, but write the project in MVC approach?
For example:
model: PHP
controller: JS (jQuery+Ajax)
view: HTML, CSS
As my friend is a professional PHP developer and will have a daily job next to, but only in the beginning of this project, he doesn't really want to learn an other language (like Node.js), because almost everything is a routine for him now in PHP.
I know everything depends on the documentation and what we have to develop exactly, but I'm just a curious mind and want to understand more. I know I have much to make up and sometimes I worry of my current knowledge, but then I think that be whatever big the challenge, there will always be a solution for it.
MVC does not mean to use differenct languages for all of the modules (model, view, controller), but to loose couple and encapsulate certain parts of your application.
Against many opinions, MVC is not the panacea for application development. It really depends on the application you're developing.
It's not necessary to use any frameworks in order to follow the MVC approach. In fact it's a pattern that can be tied together very quickly, in it's most basic form.
If you decide to use your backend as an API and pull the data via frontend, you don't need to use MVC come hell or high water. For an API for example it's not necessary to perform most of the view tasks. Instead you should care about building a performant and scalable data storage layer (which for example is able to easily provide your data in many common formats, such as XML or JSON) and a strong router that can handle HTTP Requests nicely (See if REST is something for you).
In this case you want a strong frontend which can handle templates, and also has a strong layer for obtaining, sending and handling data in general. A strong controller layer that can delegate tasks to certain parts of your application would also come in handy.
Well you see what I'm talking about. It really depends on your application. In my example the backend wouldn't exactly follow the MVC approach, while my frontend would completely. MVC isn't about switching programming languages for certain parts of your application. Instead it decouples your application structure making things a lot easier.
Of course Frameworks come in handy when developing such an enterprise scale application, but it's not necessarily required.
To sum things up: MVC has not much to do with the code itself, it has much more to do with architecture and structure of your code. How exactely you're implementing it is absolutely up to you.

HTML5 rendering [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I always read something like HTML5 games etc. But I don't believe that a game is entirely programmed in HTML5 because it is just a markup language. Normally, it is controlled though JavaScript, right?
I want to program a very very simple browser game, that I can play with my friends. But I want to code the logic in Scala.
So I came up with this structure.
The client is able to see HTML in his browser. HTML5 will be manipulated though JavaScript which opens a connection to my webserver (AJAX?). Now I can program all my logic in Scala and let JavaScript execute it (for example move pawn from position a to position b).
This would be possible, right?
As a webserver I would choose Lift.
But I have never done any rendering with JS/HTML5. Would you recommend to look in some frameworks such as LimeJs or CraftyJs?
"HTML5" is commonly used as an all-encompassing reference to a set of specifications for client-side scripting language APIs, in addition to the core markup language that gave rise to the "ML" part in the name. So "implement this-or-that in HTML5" generally means something like do it in client-side Javascript, manipulating a DOM tree as specificied by HTML5 in order to present a user interface.
It is somewhat inconsistent/illogical naming, but standardizing on inconsistent illogical terminology is what this industry is best at. :-)
http://en.wikipedia.org/wiki/HTML5
HTML5 is a markup language for structuring and presenting content for the World Wide Web, and is a core technology of the Internet originally proposed by Opera Software.[2] It is the fifth revision of the HTML standard ... a mixture of features introduced by various specifications, ... software products such as web browsers, ... common practice, and the many syntax errors in existing web documents. It is also an attempt to define a single markup language that can be written in either HTML or XHTML syntax
HTML5 on its own cannot be used for animation and interactivity - it must be supplemented with CSS3 or Javascript
Sticking with your example developers typically define an API to access your data via your web server.
Javascript would be responsible for manipulating your view (html dom), so it would actually contain a big chunck of your game logic
webserver would contain your data model (maybe it would have logic for a robot player and its next move)
client is the browser

Don't the data attribute options used in Bootstrap, Angular.js, and Ember.js conflict with Unobtrusive Javascript principles? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I've always been told it's good practice (ala 'unobtrusive javascript') separate JavaScript from HTML markup. However, I've been seeing the opposite trend with a number of new and popular frameworks such as Bootstrap, Angular.js, and Ember.js. Can someone tell me why this isn't considered bad practice?
Unobtrusive Javascript is a good practice for many places on the web. The frameworks you mentioned are often used for creating full-blown Javascript applications. In many of these apps, the experience without Javascript is often a blank page. In that environment, the value of separating your markup from Javascript is relatively low.
I'm asking the same question myself and have come to the following conclusion:
HTML is markup language for presenting documents. The semantics that everyone is referring all around is actually related to representing rich documents. This includes images and links that allow more richer experience.
The same principles can be applied to Word documents, where instead of marking a specific text as red, you can mark it as emphasis and then style the emphasis as red, which will be semantically correct way to express the intend.
The problem arises because HTML actually includes elements that allow user interaction - forms . The initial design was to allow non professionals to create simple interactive UIs. When I checked different desktop GUI frameworks there is no such thing as separation between actual view and view logic, because when you build GUI you don't need that separation.
For me the importance is how much of what you writing is content based or GUI based. Because the HTML serves two purposes it's difficult to know what to serve from the server.
Basically sites like Wikipedia, and even Stackoverflow are content oriented. This means that if they want to be accessible to broader range of clients, like bots and older browsers they should be able to stream pure html.
I'm thinking of two possible strategies when you want to provide content and some richer UI experience, like the textare where I'm writing this comment. The one is to server the html and then initialize the GUI. This is also referred as unobtrusive javascript and semantical HTML. This is what most content oriented sites do. This is mostly to be able to benefit from browsers and bots that will allow their content to be more accessible.
The other strategy will be to identify the type of client and serve different content, which can only be achieved reliably only on the client side, because in both cases html will be served. This is still close to the first stategy, because of the way HTML is used/abused as both content and GUI representation.
If you are writing an application that don't provide content but actual service/process then architecture like AngularJS and similar is suited better.
In my experience most business have to provide both. Let's say you have an app that uses HTML/Javascript to allow users to create drawings. This app doesn't need to follow any unobtrusive guidelines, but it won't be able to run on old browsers too. But if you provide a social sharing of the drawings between users, allowing comments and other content then it's better to write this part of the site in a way that bots and other clients can access the content easily.

What type of data management system should I use for a OOP Javascript web application? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm in the process of building and designing my first Javascript OOP web application and I'm wondering what kind of data structure / management system would be best to use. I know the interaction between Javascript and XML is good and fairly easy, but XML isn't meant to be used as a database.
Is it better to form a combination of both? Have a server-side language (PHP) generate XML and have it then be read by JS?
Or am I heading in the wrong direction with this?
Javascript itself doesn't do queries....it needs a helper like PHP, .net, or Java. It can traverse XML or JSON just fine like you say, but sending colossal XML documents with all possible data when only small amounts of the data is actually required will lead to massive overhead that will bring your app to its knees. It's the definition of lack-of-scalability.
My personal preference is JQuery Ajax talking to a PHP backend (transactions via JSON). If I'm dealing with the presentation of large datasets I'll always page the information server-side and pipeline it (load data ahead of and behind the current view to reduce transactions), and usually present in via jQuery DataTables. Grids are always your friend with large amounts of data. Again, personal preference, but I make heavy use of jQuery UI for layout and presentation, and I do write custom Javascript for the "nifty" one-off type things that come up. Again, any server language you have access to and are comfortable with will suffice, as Javascript is language agnostic.
Javascript can get out of hand in a hurry. I'd recommend that unless you have a ton of time on your hands that you focus on clean presentation via something baseline like HTML with judicious use of Javascript and CSS for progressive enhancement. Think about the user before you go crazy with motion, dynamic elements, etc. Don't forget the old adage, "80% of the people only use 20% of the functionality" Nail that 20% cleanly before going to town on flashy javascript fluff. Your users will thank you!
JSON is by far the fastest to parse, since it IS JavaScript.
Application frameworks like EXT.JS are already doing this with great success.

Categories