开发者

Client side vs server side basics [closed]

开发者 https://www.devze.com 2023-04-04 10:43 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

For the last 6 months I have been trying to wrap my head around Web development and understanding开发者_StackOverflow社区 the diferences beetween client-side programming and server side programming.For the moment I only know the client side at an medium level(javascript/jQuery) but I am also interested in learning PHP and MySQl for server-side programming.

What are the diferences of client side programming and server side programming?

When do I use client side and when do I use server side?

Those a web developer need to know both to be effective in writing website?


Client side programming includes any coding or computation or effects or annimation or any sort of interaction your website performs with the user via browser. But server side programming is that which performs all the task in the server only. So the user is unaware of that.

For example, PHP is used for server side programming. You design a website with HTML and use JavaScript in it to take some input from user and modify it in anyway. To be more specific, if you created a blog website and you want to specify that the user can post a max of 5000 characters. Then you do some client side programming with JavaScript to count the number of characters and any filtering or anything. But then you need to send those posts to the server. The server then performs some server side task, may be with PHP, to sanitize the input for SQL Injection and saves it into a database.

User will only know what happened in the browser but not what happened in the server. Those are background tasks.


For a web application you need both.

Best way to learn is trying to create a simple app. Consider a very simple address book app. You need to store the entries (so you need MySQL for instance).

Actually you need to be able to perform 4 basic actions with the data which is called CRUD - Create, Read, Update, and Delete. For this you need to use a language like PHP, ASP, Python, which run on your server.

To actually use the app you need a user interface which is created by HTML + JS (or jQuery) + CSS and possibly you'd also use some images.


the short answer:

client side = code runs on client machine, namely the browser
server side = code runs on server, output sent to client

A do it all web developer should know at least a little of both, but there are specialist in both areas.


I would also add that client side code is visible to anyone viewing the web page where server side code is not visible to someone viewing the webpage.


Understanding of both server-side and client-side is important. Client side is in-secure, transparent and can be manipulated by user (or hacker) in any way. Server-side is protected and can't be messed around with. Any web application with user log-ins should have back-end code.

You might be able shift your code based on your requirements. For example, you can place your code primarily on the client side with Sencha / ExtJS or similar framework, then have only a simple API service on your server. You might even avoid coding for the backend completely by using some API engine.

On other hand, you can stay completely on the server-side if you pick a PHP UI Framework. Such a framework would worry about your user interface letting you use PHP only. Unlike languages such as Java and .NET There are very few UI Frameworks for PHP. I wish they would have more publicity.

Coding for both front-end and back-end makes development much slower, but it's a commonly accepted way right now.

0

精彩评论

暂无评论...
验证码 换一张
取 消