Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Pretty simple question with a complex answer.

Should a project start with the client or the server, and why?

Where should a single programmer start a client/server project?

What are the best practices and what are the reasons behind them? If you can't think of any, what reasons do you use to justify why you would choose to start one before the other?

Personally, I'm asking this question because I'm finishing up specs for a project I will be doing for myself on the side for fun. But now that I'm finishing this phase, I'm wondering "ok, now where do I begin?" Since I've never done a project like this by myself, I'm not sure where I should start.

In this project, my server will be doing all the heavy lifting and the client will just be sending updates, getting information from the server, and displaying it. But, I don't want that to sway the answer as I'm looking for more of an in depth and less specific answer that would apply to any project I begin in the future.

share|improve this question

closed as not constructive by Jim G., Eric King, Walter, Yusubov, Matthieu Sep 4 '12 at 13:58

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.If this question can be reworded to fit the rules in the help center, please edit the question.

You start with how the client and server would communicate. Methods, infrastructure, latency requirements and scalability requirements are a good start. – Oded Sep 1 '12 at 16:48
@Oded: +1 That should be an answer rather than a comment. – CesarGon Sep 1 '12 at 17:03
There is no best practice. It depends on the context of what you're building. – Dave Hillier Sep 1 '12 at 19:23
Your mistake here is assuming there are two options - client first or server first. When in reality it will be Client and Server concurrently. – GrandmasterB Sep 1 '12 at 20:20
@GrandmasterB agreed. In addition, this question is very close to the "what project you should do next" style that is off topic for – Dave Hillier Sep 1 '12 at 22:47
up vote 8 down vote accepted

With any client-server system, you need to start with defining how the two should communicate:

  • What infrastructure to use? Connected? Disconnected? Stateless? Stateful?
  • What kind of communication method? Push? Pull? A bit of both?
  • What calls should be available to each side?
  • What are the latency requirements?
  • What are the scalability requirements?

(there are probably many other questions you need to answer before you can start implementing)

Once you drive out the non-functional and functional requirements, you can start defining the technology to use. At this point you can start by coding some simple exchanges of information between client and server - you evolve both at the same time.

share|improve this answer
You probably also want to think about whether there will be only one client, or if the server might eventually be used to serve different sorts of clients. – Steven Burnap Sep 1 '12 at 17:49

There is no best practice. Whether you build a client or server first depends on the context of what you're building. However, if you are starting from scratch then you need to build both.

If you're building a client-server project for fun, why do you care what to build first? You're going to need both, build just enough of each to demonstrate that they can connect and prove that features work. Building a client that connects to a basic server should take no more than an hour. There are plenty of basic examples on the web.

@Oded correctly answered with several questions. However, the chances are unless you're building something with high realtime (latency) requirements then a web project will be sufficient. You will then already have a browser to act as your client. Web technologies offer solutions to the common problems that distributed system developers solve.

Are there any legacy clients or servers to the thing you're building. If so, then consider building client and using the existing server or vice versa.

share|improve this answer

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