views:

126

answers:

3

Hi.

I'm looking to create a new site and in order to encourage myself to create a powerful API for others to use, I'm tempted to write the API and use it myself to build the the actual site. The idea being, if it is capable of running the primary site, then it will give other users plenty of options to put their own spin on things. It will also encourage me to keep the API up to date.

What I'd like to know is whether this idea is worth going with, or whether its just plain nuts.

Is this common practice? Will it likely result in over complicated code? Will it cause performance issues if (by some chance) the site was to take off?

Thanks in advance.

A: 

There are some really great APIs already. Why reinvent the wheel?(I'm assuming this is what you want to do)

Silfverstrom
Thanks for the response. I'm looking to create an API that can be used to access data that is specific to my site. I do however intend to follow standards set by other APIs.
greggannicott
+2  A: 

It is common practice to build a public api and consume it internally, and from my experience it results in cleaner code (rather than maintaining two sets, one internal, one external). There may be a performance hit, but I would not worry about that too much until you see some real demand. Otherwise you can get yourself wrapped around solving problems that don't exist.

nikudesu
I appreciate and agree with what you're saying regarding the demand. What I didn't want to do was spend ages writing code only to have to rewrite it the moment a small number of people decide to view the site. If I am lucky enough to have such issues, I'll deal with them when the arrive.
greggannicott
+2  A: 

It's a great idea, as long as you are doing it for yourself and not using up someone else's time/money.

Writing your own framework from scratch is a great way to teach yourself about planning and writing code. It may take a long time and be a long adventure, but I can personally attest that it forces you to become an expert in everything.

For anything that is being developed on someone else's dime, or which is mission-critical (security or performance) however, I would recommend re-using an existing framework where it is logical to do so.

thomasrutter
Thanks for the advice. Luckily this is something for me to do in my spare time, so I can experiment with such things. It is very much a learning exercise so I'm pleased that you think its a great idea.
greggannicott