|
|
#1 |
|
Mobile application architecture
Hey people. I have a question regarding the architecture of mobile apps like fore iPhone and android.
I have written an application in objective c for iPhone but I need to know how the 3 layers/tiers are: Tell me if i am doing this right: The presentation layer/ front end : the GUI made in interface builder. And / or for android. Business logic : I don't know what that is in my application Back end / database server layer: I have a back end in parse but my code is in Xcode not on any server. So is this a good explanation for an essay ? |
|
|
|
0
|
|
|
#2 |
|
Model Stores data.
View presents data. Controller manages moving and manipulating data. Model should basically be structs for organizing data. View would be things like layout files in Android or xibs or storyboards in iOS. Controller is everything else. That's how I understand it, anyways. This is for any OO programming, it's not specific to mobile. |
|
|
|
0
|
|
|
#3 | |
|
Quote:
The best response I got to this in the past was that the View and View Controller should be independent from the model. This way you can attach any model to the ViewController so the data entered and displayed in the view passes right through to the model. I have always looked at MVC design as M-VC. The ViewController and the View have to go together to pass data in and out of. My "M" Models have been what ever custom Classes I need. I create different classes to handle different things. One class for reading and writing to memory like plists and ceching if things exist. Then another Class to process images and return the result back to the screen. So in fact my my MVC design has been looking more like MMM-VC for example. My Models are the different Classes that handle the workload. Or at least this is how I have come to understand it.
__________________
I know more than yesterday. Lars |
||
|
|
0
|
|
|
#4 |
|
It takes designing and refining a lot of programs to see it, but I think the division is pretty distinct.
Your view is your interface file. Your storyboard and your xib are your view on iOS and OS X. Your layout is your view on Android. Your model is a bunch of dummy classes that store data. They have getters and setter methods traditionally, but with Obj-C 2.0, these were hidden away behind properties. Your controller is all of the logic that makes your app work. Models are interchangeable between programs. CGRect and CGPoint are examples of models. They do nothing but store a few primitives. You use them in a whole variety of programs. An entry in an address list is a model. You can use it in a whole variety of programs, from something social related to something that stores business contacts. Views are interchangeable between programs. UIButtons and UITableViews are examples of views. They can display any data that you please. Controllers are generally not interchangeable between programs. They take the data stored in the model and make sense of it and pass it to the view to display it. I think the reason people don't see the division is because they haven't made classes of all three types yet. I think when this started to click for me was when I needed to make a bunch of special views for an Android application. IE, I needed a "Sort Buttons", which allowed the users to tap on any column header to sort it up or down or not at all. I also needed to make models that stored ~400 different variables and to be able to send them between different devices. I guess something that maybe makes it easier to understand is this: DRY - DONT REPEAT YOURSELF. If you ever need code twice, move it to a separate function, or class, even. In moving my code around like that, I accidentally came to understand MVC.
__________________
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed. Like it on Facebook! |
|
|
|
0
|
|
|
#5 | |
|
Quote:
__________________
Regards, Duncan Champney, WareTo. Check out our latest app, Face Dancer, available for free on the App Store. |
||
|
|
0
|
|
|
#6 |
|
AOW it was funny that you said "DRY - DONT REPEAT YOURSELF." because that is how I first started writing my own Classes and got away from writing all my code in the ViewController. I found myself pasting identical code around to do the same thing. That's when I began to think about creating my own classes. I think that is a good rule of thumb, DRY
Sorry to disturb the original intent of this post if it was not MCV.
__________________
I know more than yesterday. Lars |
|
|
|
0
|
|
|
#7 |
|
I am thinking more about the three tier architecture. Is it the same as MVC?
View= presentation tier Controller=middleware/business logic Model = data tier / back end And should i put my "business logic " hate that word on the server or on the client side ? And is it possible to put business logic code using fx java on a server so I don't have to write the whole application for android ? |
|
|
|
0
|
|
|
#8 | ||
|
Quote:
Think about this: is it the sort of app that will have different clients? You might have Android and iOS clients, maybe also a web client? Is the "business logic" you're writing applicable to all of those clients? If the answer is yes, then you don't want to rewrite your "business logic" every time. Putting it on the server means you only have to write it once, and your clients are simpler. ---------- Quote:
From the perspective of writing iOS client code, your "middleware/business logic" all comes under model. |
|||
|
|
0
|
|
|
#9 | |
|
Quote:
I am writing an application (ios) or a prototype for a class project but I still need to explain the technical aspects of the whole system and distributed system. |
||
|
|
0
|
|
|
#10 | |
|
Quote:
The server will typically return data to the client in either JSON or XML format - it's really how you define your data model/schema in the client-server interaction that's important, rather than what languages you're using. |
||
|
|
0
|
|
|
#11 |
|
Thanks
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 07:51 PM.








Linear Mode
