CodeIgniter Forums
Some Noobie Questions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Some Noobie Questions (/thread-22837.html)

Pages: 1 2


Some Noobie Questions - El Forum - 09-21-2009

[eluser]Crath[/eluser]
1) My biggest concern with starting to use CI is, loosing my current practices. Currently, obviously, I create everything from scratch. If I use CI, am I going to get so accustomed to its way of interfacing a database, or managing data (I haven't dug into it deep yet, so im not sure of the capabilities) that I will feel a bit uncomfortable doing it outside of CI, for example if I am working on a clients website that doesn't use it.

2) I am really looking forward to the MVC style coding. It looks really like a really interesting jump for me, and could help me keep my sites much more organized and clean. The one part I am worried about is, how bad is the learning curve? I have been creating apps for quite a while, and the MVC does make a lot of sense, but am I going to be lost for awhile? Breaking my code apart (models and views and controllers) seems like a scary thing at first. And, related to #1, will it affect my ability to write a full standalone class on a clients website, when I am not in a CI environment?

3) How difficult is it to upgrade CI? I used Joomla for one of my projects, and ended up writing a lot of custom code into the core, which made it impossible to upgrade it without killing the entire site. I know that Joomla is a CMS, while CI is a framework, so I will not be editing any core files (i assume), so everything should go smoothly?

4) Was CI a good decision? I know this is the official CI forum, so chances are you will say yes, but I'm sure many people here also have experience in other frameworks. I just feel, that for the applications that I will use it for, knowing CI will be extremely beneficial. Should I look into another framework before I dive in? This is my first framework, so its a whole new world.

5) How well does CI and jQuery or Prototype mix? I know one is client side and one is server side, but I sometimes here of CI and jQuery working well together (maybe its just their personal preference). I haven't decided which client side framework I wanted to use yet either, but I am leaning towards jQuery.


It took me up until this point to finally go with frameworks. I was always against using them, preferring to write my own classes and such myself, but that's just so repetitive and can get kinda messy. So hopefully getting these questions answered will get me on my way, thanks!


Some Noobie Questions - El Forum - 09-21-2009

[eluser]BrianDHall[/eluser]
1) First, you won't miss your current practices. You WILL miss CI when you aren't using it, the same way you'd miss driving a Ferrari if you had to go back and drive a Taurus. However, you won't be gimped or 'unable to drive' - CI does not change things so radically that everything is fundamentally different. In fact, its really just some smart OOP design and a little abstraction. The code is very clean I think you'll find, and with experience you'll get to know what is going on under the hood just because its so easy - not because you have to.

You'll still be able to code without it, but you'll miss the helper functions, the super-easy to use libraries, etc.

2) There is extraordinarily little learning curve, because CI basically lets you do what you want. You won't get it 'right' the first time, but who cares? You'll probably use the controller for too much, the models not quite right, and views like little more than templates. Your site will still work fine and you'll be glad you used CI.

This was my experience. Now on my next project I have changed a lot of the way I use CI, and on the next one I'm sure I'll make more changes because I have learned better ways of doing things. But my old code still works just fine, and it isn't hard to go back and make updates, changes, etc.

3) Upgrading is amazingly simple. Been the Joomla path - nightmare! Get that bad experience out of your head, CI is nothing like it. There is little to no reason to ever 'hack' the core files - its easy enough to just 'extend' them with your own custom classes and functions.

4) You couldn't pick a better 'first framework', in my opinion, no matter what you look at. Everything but perhaps Kohana has a vastly higher learning curve, and for Kohana I like the support and base of information to draw from better with CI (Kohana is basically a fork of CI that focuses on increased OOP and only php5, amongst other things).

5) They mix easily...because they don't really touch each other at all. There are some libraries and such that are supposed to ease the use of them, but I have only minor experience here. I can say I've used both JQuery and MooTools scripts and they worked without problem.


Some Noobie Questions - El Forum - 09-21-2009

[eluser]Crath[/eluser]
Thank you for all the input! I am only really left with one question to your response, is Kohana something I should be looking into?


Some Noobie Questions - El Forum - 09-21-2009

[eluser]BrianDHall[/eluser]
I don't know of anyone with bad blood with them, so you certainly can: http://kohanaphp.com/

I strongly considered switching early on when I heard so much about the value of ORM, but then I found ORM for CI in the form of DataMapper Overzealous Extension and haven't looked back since.


Some Noobie Questions - El Forum - 09-21-2009

[eluser]Crath[/eluser]
[quote author="BrianDHall" date="1253612923"]I don't know of anyone with bad blood with them, so you certainly can: http://kohanaphp.com/

I strongly considered switching early on when I heard so much about the value of ORM, but then I found ORM for CI in the form of DataMapper Overzealous Extension and haven't looked back since.[/quote]So its like, CI with more stuff packed with it?


Some Noobie Questions - El Forum - 09-22-2009

[eluser]BrianDHall[/eluser]
That's the goal of Kohana, basically. From their mouths, it is supposed to be "community backed instead of company backed", they jettison support for PHP4 with the logic that it is holding CI back, and they do some other various things along those lines. I have heard people use it and come back to CI, so its not a slam-dunk, but beyond that I can't comment as I haven't personally used it.

What caused me to stay away was reports that new versions tend to break older programs, and that documentation can be dodgy. There's also talk I don't fully understand in Kohana about V2 vs V3, and when I picked CI I really didn't want to get myself into a framework that wasn't extremely stable, well documented, and easy to understand.

On the other hand, some people swear by it and say its the best thing since...well, CodeIgniter. YMMV - personally, I'm happy just trying to learn all the tricks of CI. The man who chases two rabbits catches none, and all that Smile


Some Noobie Questions - El Forum - 09-22-2009

[eluser]Crath[/eluser]
Alright, I guess thats enough for me. I am gonna take a wack at making a site in CI. We'll see what happens Tongue

thanks!


Some Noobie Questions - El Forum - 09-22-2009

[eluser]Crath[/eluser]
New question for you sir.

Sofar, I think I have the controller and view down.

Use controller to handle any input, as well as use it to work with the db, and build the page the user wishes to view. Then, when all the stuff that needs to be done is done, pass the content i need to output to the view file, which glues it into a template file, so to speak.

Where does model come into this? :roll:


Some Noobie Questions - El Forum - 09-23-2009

[eluser]wiredesignz[/eluser]
This would be a good point for you to learn some basics of the MVC design pattern:
http://www.phpwact.org/pattern/model_view_controller


Some Noobie Questions - El Forum - 09-23-2009

[eluser]BrianDHall[/eluser]
Indeed, wiredesignz posts a good link well worth reading.

A really nutshell version is a model is what 'models' your applications data. A typical design pattern is a model represents one table in the database, and possesses all functions related to CRUD (Creating, Retrieving, Updating, Deleting) and typical uses and manipulations of that data. So you might have a User model that handles login, or a Leads model that handles sales lead data including assigning the lead to the proper Staff (which is another model), etc. Models can handle both their own table and interaction amongst other related models (like a forum might have Users, Posts, and Threads, and of course they would have to be able to interact in some ways).

I use ORM, such as in Datamapper Overzealous Extension to handle CRUD and relationships between models (so say a given User belongs to a certain UserGroup, which have created various Listings, and each Listing can have various PropertyTypes, etc), but this is what you might call "Advanced Use of Models".

When I started I didn't do things quite 'right' so I used models to represent certain functionality like userauthentication (but no users model and I had three distinct tables of users), one for Categories that wasn't really designed the way it should be, etc.

CI lets you learn as you go, which is again one of the traits I like the best about it. You don't have to fret too much about doing things "the right way", because it isn't hard to refactor and better to do things 'wrong' but that work than nothing at all.