I was wondering about client side vs server side calculations regarding websites that provide some convenience type service. For example, an online website where you input a certain date and the website tells you how many days between today and that date. Or a website that tells you steps to solve the inputted math equation. Do these types of websites warrant server side calculations of any kind?

  • I think It depends on the nature of the maths. Probably, any client is capable to calc the number of the days between two dates. The client won't need a significant amount of resources to do It. Either the maths are rocket science. But if we were speaking about the Google's algorithm for searching, that would be another story.
    – Laiv
    Feb 10, 2018 at 8:17
  • Personally, having built a couple of server-client applications, I always start out performing as much as possible client-side, and progressively moving to the server side only when it starts to make sense, which is usually for me when the local compute time exceeds the server side compute time plus the latency.
    – David Cian
    Feb 10, 2023 at 10:04

1 Answer 1


There is no simple answer to this question. There are many different software architecture/deployment strategies that can achieve this. It all depends on how complex your application is and how complex can it become some day.

Let's start with a simple MVC type of architecture. Here you treat your client side code as mainly a view, your server as a controller, and transfer the model (i.e., your data) between the view and the controller. This allows you to keep all the logic in one place and serve multiple views (e.g., phone apps, websites, or even text prompt interfaces!). So far so good.

However, when you set out to do this, you will find yourself defining multiple MVCs inside your view itself. Delegating every single controller to the server side is going to complicate your design and/or degrade the performance (do you do 2+2 on the server side or the client side?). So at some point you have to stop building controllers on the server side. The art is in knowing where to stop.

Three simple guidelines can help. First, if a calculation/algorithm is a constant of the world and unrelated to the "business" logic of the application then you can generally code it on the client side. Second, you may not want to do so if the algorithm is complex (needs a lot of data from other/your own servers, needs a lot of CPU that your typical user won't have etc.). Third, you may not want to ship logic on client side that gives you a proprietary edge for the fear of someone reverse engineering your logic.

Let's take the equation breakdown problem. It is non trivial, can change for there are multiple ways to solve a given problem (including trivial step additions to simplify existing steps), and costly to build (so you may not want someone to steal your hard earned algorithm).

  • Thank you! I understand now, I think I will use a server in case the application becomes more complex and I want to keep it safe from theft.
    – JayJuly
    Feb 10, 2018 at 8:10
  • @JayJuly you can always delegate non-critical and small operations to the client, releasing the server from extra workload.
    – Laiv
    Feb 10, 2018 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.