How to create web chat?

How does web development work?

  • Hey, I'm sorry if this is a weird question but how exactly does web development work? I've been searching around and can find some bits and pieces of information but I still don't thoroughly understand how to create dynamic web pages. I've been programming desktop applications for most of my life and have never done any web stuff (not even HTML). I currently know C and Python and was thinking of making a site in order to learn how all of this works. Could someone please explain the relationship between client-side and server-side processes as it pertains to using a framework like Django. If you could explain what a framework is too I'd appreciate it. Basically, if you could give a play-by-play of how one would make a forum like this, or a chat room, for example, using Python/Django, that would be swell. If you have any links you think could help, please feel free to share them!

  • Answer:

    Web development is all about client-server interactions. A client (your web browser, smart phone, etc.) make a request over a network, probably using the HTTP as a protocol, requesting information. A server receives that request, and processes it. A common and popular piece of webserver software is Apache. One of the simplest thing a webserver can do is to return a file on the hard disk of that server.  So if you have a .html file sitting on disk, it returns that file. Or, you can configure your webserver to execute some sort of server-side logic.  That's where your web app comes into play. The logic of your web app determines what content to return, whether to load information from a database, how to format the response, etc.  You can have a simple "Hello world" style app where you go to a web page and it just returns an HTML page with the current time inserted into it.  Or there can be a massive amount of work happening on the server to generate a response. Over time, people creating web apps realized they were doing the same things over and over again.  So they created, say, libraries to make it easy to parse URLs or format the HTTP headers that should be returned.  They then built frameworks to make it easier to do common things. For example, it's common to have a page that displays a record from a database (say your account preferences), and which allows the user to edit their account information, submit it back to the server, where it should be validated and then saved to the database.  Frameworks can make it possible to create a page like that with relatively little work. Frameworks often have some extra security built into them, to help avoid, say, SQL injection attacks.  (http://xkcd.com/327) HTH

Jon Moter at Quora Visit the source

Was this solution helpful to you?

Other answers

I suppose the best way to describe the difference between clientside and serverside is that the client side has no logic. So (ignoring what javascript can do) the client side can't make decisions, can't do ifs and elses, can't add up, etc etc The clientside merely renders what is given to it by the server - the browser normally being the thing doing the rendering. The clientside is stateless. It is a copy of the information created by the server, delivered (typically) by an HTTP request. One of these implementations of the information rendered is HTML. With javascript there is now the ability to change what has already been delivered to the client. And javascript can use logic - like the logic I described on the serverside - but the logic happens at the clientside. But until there is another HTTP request (e.g. via AJAX) then the changes to what is rendered in the browser only exist on the client - and only on that one single copy of the rendered content i.e. the one in the current browser - you aren't changing everyone else's view. Only another HTTP request would that any of that information be conveyed back to the server. So the serverside is where the logic happens. Normally with some access to a data store e.g. database, static files, XML. The reading, writing and interpreting of this data is what the server does. The decision maker. Frameworks are a bundle of code that has already been written by someone else to give you a head start so you aren't writing all the mundane stuff each time you start a project e.g. database operations. Look at frameworks like a toolbox. You have all your spanners there - these are the bits of code pre-written - so you don't have to forge a spanner each time you need to tighten a nut. You will still have to use the spanner - it won't tighten the nut on its own - but the point is the hard work of creating it is done. With regard to the word "dynamic" that is kind of a way of saying that the HTML being rendered isn't just the same HTML being "served" by the server each time, but instead some decision making is being done by your code before it sends the HTML to the client. So you could write a piece of code on the serverside that would never change e.g. fetch the posts from my forum database and return the HTML. That snippet in the code would be written once by you, but each time the database changes e.g. a new post is added, then the actual served HTML would be different. Look at "dynamic" as being the content rendered changing, but your severside code is never any different. Mastering the art of that last bit - creating the code that serves ever changing data most effectively/efficiently - is (in my view) what web development is. Hope this helps. (Caveat: this is a really basic view of what goes on)

Andy Gwilliam

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.