• 0

Server Side vs. Client Side Logic


Question

I do web/mobile development professionally, but there is something that has bugged me for a bit and I was wondering what other peoples opinions are.

 

For the back-end, I write C#/.NET CORE Web APIs that run on Azure/Dotnet which use EFCore to talk with the database (MSSQL). For the front-end I use Typescript/HTML5/CSS. 

 

There are things that I can do server side OR client side and am never 100% content with my decision to do one over the other. A quick example would be sending an analytics object. Does it make sense to rely on the API to send down the perfect structured/calculated analytic data for each field or should I send the raw dataset down and let the Typescript do the structuring. To what extent should I do processing/formatting/calculating server side vs. client side?

Should I have the API do the heavy lifting, or let the client take over and let the users pc/device do the work? I know things like basic validation can be done client side without a round trip, but when it comes to the actual JSON objects coming down, is it smarter to just let the API build it fully, or just send down the raw data and let client build it.

Link to comment
https://www.neowin.net/forum/topic/1362302-server-side-vs-client-side-logic/
Share on other sites

1 answer to this question

Recommended Posts

  • 0

It's always a balancing act when it comes to deciding whether or not you want to strictly rely on server-side processing (especially when it comes to things like validating input), or whether you want to compliment that with client-side validation as well. If you pair server-side processing with client-side processing, the obvious benefit is that in some cases it will avoid the need for more processing to be done on your server than is absolutely necessary. This becomes evident when we are talking about validating user input. Sure, you'll still need to validate them on the server-side, but for a lot of users, you might only need to do this once because there will also be client-side validation to make sure it's extremely unlikely they will submit invalid information.

 

If you are concerned about the performance cost of making the client do some of the heavy lifting, the browser developer tools are there to help you find out if that's a trade off you would like to make. The main question you should ask yourself is this: does this provide my users with a better user experience? In the case of validating input locally on the client's machine, yes it does. It not only benefits me, but it also means the user gets instant feedback if something's not right.

 

The first port of call is to check your browser's developer tools to identify the performance difference with and without client-side processing. The obvious things you can check is the time it takes to complete a specific action, and how much memory it consumes, with and without the client-side code.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Windows 12 perhaps would have codename Midnight of the company profits 😂 This system and it's update program gets more ridiculous with every new version
    • yet there are still dumb people decisions which takes the bait and go just where Microsoft guides them. left right left right just as a water particle in a microwave
    • Free Download Manager 6.29.0.6379 by Razvan Serea Free Download Manager is a powerful, easy-to-use and absolutely free download accelerator and manager. FDM accelerates downloads by splitting files into sections and then downloading them simultaneously. As a result download speed increases up to 600%, or even more! FDM can also resume broken downloads so you needn`t start downloading from the beginning after casual interruption. FDM lets you download files and whole web sites from any remote server via HTTP, HTTPS and FTP. You can also download files using BitTorrent protocol. In addition, Free Download Manager allows you to: adjust traffic usage; to organize and schedule downloads; download video from video sites; download whole web sites with HTML Spider; operate the program remotely, via the internet, and more! Free Download Manager is compatible with the most popular browsers Google Chrome, Firefox, Microsoft Edge, Internet Explorer and Safari. Free Download Manager 6.29.0.6379 changelog: Improved new desktop UI style. Improved add-ons support. Libtorrent updated to 2.0.11. Fixed: various bugs (including ones in the classic UI style). Download: Free Download Manager (64-bit) | 45.8 MB (Freeware) Links: Home Page | Linux, Mac, Android | MS Store | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Would like nice for a Steam Deck, but I don't think I would like this on a PC.
    • Zen Browser 1.14.7b is out.
  • Recent Achievements

    • Week One Done
      hhgygy earned a badge
      Week One Done
    • One Month Later
      hhgygy earned a badge
      One Month Later
    • One Year In
      NIKI77 earned a badge
      One Year In
    • Week One Done
      artistro08 earned a badge
      Week One Done
    • Dedicated
      Balaji Kumar earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      636
    2. 2
      ATLien_0
      237
    3. 3
      Xenon
      166
    4. 4
      neufuse
      143
    5. 5
      +FloatingFatMan
      123
  • Tell a friend

    Love Neowin? Tell a friend!