0

I'm creating a website in PHP and mysql. I plan to create a native smartphone app for it in the future. The app will allow users to interact with my website's database and receive notification when new data is posted to their accounts. What should I implement in my website while anticipating a future mobile app for it?

CyberJunkie
  • 21,596
  • 59
  • 148
  • 215
  • 1
    Don't worry about it now. Websites can be changed... – Marc B May 12 '12 at 22:52
  • True but I think it will be easier if my code is already app friendly or flexible – CyberJunkie May 12 '12 at 22:59
  • Planning is good (but out of the scope of this website), however what you do sounds like a typical mistake done, instead what you need is [YAGNI](http://en.wikipedia.org/wiki/You_ain't_gonna_need_it). – hakre May 12 '12 at 23:13
  • 1
    Totally disagree with YAGNI in this instance if you know you will be creating multiple front ends for the same application. Refactoring a large application to pull out all the business logic is a total unnecessary pain in the butt. A little thought into your core architecture is not a typical mistake. – Joel May 12 '12 at 23:46

2 Answers2

1

When you create your native app, you are going to want to access your business logic and database via an API that you create. So when you are developing your website, you really want to think in terms of a MVC (model-view-controller) architecture. Ideally, both your website and mobile app will share the same model and controllers, and you will simply implement the views (very) differently in each.

For example, when you do a login on the website or in the app, you want it to call the exact same code base on the server (and pass the exact same parameters) to process the login. Therefore, make sure to decouple your business methods (controller logic) from your presentation layer when you design the site and always think in terms of "should this functionality be exposed in my API or is it website only presentation".

If you do this now, it will save you a lot of pain later.

Joel
  • 15,654
  • 5
  • 37
  • 60
  • Thank you! To my understating API is key to make my website work on multi-platforms? I'm using MVC on Codeigniter :) – CyberJunkie May 13 '12 at 00:23
1

I have been creating the same type of system for a few customers of mine. I have built them a website where there customers for example, make a hair cut appointment, that then sends a notification to the hair stylist notifying them of the new appointment information. Is this something similar to what you are looking for?

Also if so, i need to know what language you will be coding the phone app in. I suggest using Java if your going to be learning a new language to do this.

As for needing to implement anything prior to actually creating the mobile app. Thats not necessary.

NodeDad
  • 1,519
  • 2
  • 19
  • 48
  • Users will use the mobile app to enter data and yes they'll be similarly to your app. I'll be making the app for android. – CyberJunkie May 12 '12 at 23:34
  • 1
    My app is android as well, so no, nothing needs to be done prior to building your app. And Java is the best way to go for Android in my opinion. Since your questions been answered regarding if you need. As Joel said in his answer, it is suggested to do so now of course its gonna take away pain later when implementing it, but its not going to force you to recreate all of your code later on when wanting to implement the feature. Is there a specific reason your not doing it all now? – NodeDad May 12 '12 at 23:58
  • 1
    Thanks for the help! I want to launch the website first and see the response it gets before investing time and money in a mobile app. With today's technology I think its best to have code that works on multiple front-ends. – CyberJunkie May 13 '12 at 00:19