Welcome Guest, Not a member yet? Register   Sign In
Developing a Large-Scale Application in CI
#1

[eluser]oddman[/eluser]
Hello everyone! Smile

I am currently in the process of developing a browser-based game (not flash). I haven't been using CI long but what I have found is that it sacrifices development time for performance (and this is what we're after for the project, so it's a good thing!). There are a couple of things while I've been working with it that have raised questions as to how I would do it, or how best to implement. This topic is about one of those questions.

Basically I'm looking to use CI as the middle-man - getting the data/output it needs, processing input, then showing the display to the user. As part of this browser-based game, there is going to be a fairly large library that sits in the background that I want CI to be communicating with.

There's a couple of things I want to know:

1. Are there any shortcomings in using this approach from a software design viewpoint?
2. How hard is it to use CI's model system in order to retrieve data from outside of CI?
3. Is it possible to put a layer inbetween the controller and the model?
4. How hard would it to be to introduce a request-type layer. For example, if I send a json/ajax request from the view via a javascript layer, would it be difficult to have the application controller check the request then modify the output depending on the request?

I have some other questions but these are the most pressing.
#2

[eluser]oddman[/eluser]
Anyone have any ideas as to the above?
#3

[eluser]xwero[/eluser]
2. the model has no functionality on its own so you can put all kinds of data retrieval code in the models.

3. yes but in practice this will mean the in between layer is going to be a hybrid controller-model. I did a hook that loaded the model and a validation model/controller based on the controller and method name.
#4

[eluser]oddman[/eluser]
2. Actually I was referring to having a library that has no relation to CI, using it's model system (simply for consistency)

3. This is kind of a reference to #2. I want to have the controller make calls to this library, which will then make calls to the models it requires, or possibly even access already-loaded models.
#5

[eluser]rogierb[/eluser]
Code:
1. Are there any shortcomings in using this approach from a software design viewpoint?
2. How hard is it to use CI’s model system in order to retrieve data from outside of CI?
3. Is it possible to put a layer inbetween the controller and the model?
4. How hard would it to be to introduce a request-type layer. For example, if I send a json/ajax request from the view via a javascript layer, would it be difficult to have the application controller check the request then modify the output depending on the request?
2: that is the basic idea behind models: getting data. No.
4: You are talking about basic ajax caal, which will in 90% of the time go to a controller anyway, so, yes it is possible. We even go from controller to library, back to controller to another library, back to conroller and then parse the data back through the calling view.
#6

[eluser]xwero[/eluser]
It seems that the library you use is an application on its own?
#7

[eluser]xwero[/eluser]
4. check if the $_SERVER['HTTP_X_REQUESTED_WITH'] key is present to identify ajax calls
#8

[eluser]oddman[/eluser]
[quote author="rogierb" date="1240410710"]2: that is the basic idea behind models: getting data. No.
4: You are talking about basic ajax caal, which will in 90% of the time go to a controller anyway, so, yes it is possible. We even go from controller to library, back to controller to another library, back to conroller and then parse the data back through the calling view.[/quote]

Okay, I mustn't be explaining myself very well because the answers I'm getting aren't really answering my questions.

for 2, I'm talking about having a library outside of CI utilising the models I specify within CI. Is this possible or not, and if so - any links/references as to how I'd do this?
#9

[eluser]rogierb[/eluser]
Code:
for 2, I’m talking about having a library outside of CI utilising the models I specify within CI. Is this possible or not, and if so - any links/references as to how I’d do this?

I assume the library is class based so why not load the class into the CI superobject.
Once loaded, you can use the entire superobject in your library and vice versa.

Sorry, don't have any references.
#10

[eluser]oddman[/eluser]
Cheers rogierb.

The main class for the library would definitely be loaded into CI, however classes loaded within that won't have direct access (I don't think). Either that or I pass the class all the data it needs... hmmm.




Theme © iAndrew 2016 - Forum software by © MyBB