Tag Info

Hot answers tagged

17

I'd always use an off-the-shelf framework. There is almost never a good reason to build your own from the ground up. You'll spend a lot more time with the plumbing work and bug fixing writing your own than relying on tested and optimized methods already existing in the OS packages. Most of the frameworks have built in methods to extend them if needed and if ...


11

I've written virtually all of my sites from scratch. In my case, the reason is primarily because I enjoy creating things and that's also a great way to learn. It's much less fun for me to spend time trying to learn someone else's code than creating my own. But that's just a personal reason. If you find a nice off-the-shelf package that does exactly what you ...


11

Zend Framework is the obvious choice, it's the more well designed, mature and stable of the frameworks you list, and perfectly suitable for RESTful applications. That said and although I've build numerous apps with it and not just "Enterprise" applications, it's notoriously hard to get the hang of and it might just not be your cup of tea. There was a ...


10

The problem I see with your approach is that you are building a REST API for only one consumer, your controllers, and that's overkill. Don't just add a layer just to pass data from one layer to another, there's no point, you'll be creating work for yourself for no additional benefit. One (quick) way to make your API useful would be if it was the only ...


6

The following information is taken from the CodeIgniter-Documentation under http://codeigniter.com/user_guide/general/routing.html. Routing rules are defined in your application/config/routes.php file. In it you'll see an array called $route that permits you to specify your own routing criteria. Routes can either be specified using wildcards or Regular ...


5

I's say that a model per table is just recreating your database in a class structure. It is known as a anemic model and considered an anti-pattern. That is because classes are intended to have both data and behaviour. If you restrict your models to a single table, where do you put the code (behaviour) that needs to deal with data and behaviour from multiple ...


4

Been there, done that; I always felt like I was cargo-cult-programming with rails, whereas codeigniter is pretty lightweight just offering the basics, so it's hard not to see under the hood. Web.py and Werkzeug are python frameworks that are pretty lightweight and don't hide all the details from you.


4

Rails is a bit of a learning curve, there's no denying it. I would strongly recommend learning Ruby properly before you start, otherwise the syntax (which looks very simple when you're just reading code) becomes a bit hit-and-miss when writing. Also try Rails for Zombies and see how you get on there.


4

Well CodeIgniter isn't a CMS first off, it's a MVC framework for PHP. If you are looking for css templates you could try a site like http://www.oswd.org/. Or if your looking for inspiration, http://www.csszengarden.com/.


3

N-Tier is not necessarily on different networks. Each tier is in a separate process, it could all be on one machine. 3 tier is somewhat out of fashion due to the out of process marshaling it requires. Any extra tier, read: process boundary or worst communication across a network transport, is expensive. In a 3-tier system the second tier is usually the ...


3

"These classes can generally used on multiple models/views/controllers". From a MVC perspective there is no problem of a model being used in several controllers and views. So you are left with the model, but as far as I see, there should simply be one model class for each of those objects, since they relate to one database table each. Then they may ...


3

The purpose of the MVC pattern is to achieve separation of domain logic from the user interface, following the principle of Separation of Concerns: In computer science, separation of concerns (SoC) is the process of separating a computer program into distinct features that overlap in functionality as little as possible. A concern is any piece of interest ...


2

I had problems to locate the source code repository. I could find one on Bitbucket, it is linked from Codeigniter wiki (scroll down to "Mercurial Server"): Codeigniter Reactor / license.txt That's the information to gather from my point of view. And it's what has been already commented to your question: "Why not contact application authors?" and the pointer ...


2

In general you should create your models not per table or per controller but per business object. Sometimes it maybe a 1:1 relationship with your tables structure or with your controllers, but not necessary. In your example you may have one users_model class that is called from several controllers. This is fine and sometimes even desirable. However in most ...


2

Just sharing what I do. I let the users directly access the module. I have separate controllers for both backend and frontend for the module within the module. All the backend controllers extend Admin_Controller and frontend controller extend Front_Controller. The admin page is rendered by the module itself (there is a master template for the admin ...


2

My approach within Zend Framework has been to have a base class of SecureController which all controllers that require authentication must extend. In the SecureController I have a pre-dispatch authentication check for whether a user is logged in else forward to the login page. After the login check is completed, I then carry out an authorization check ...


2

CI's profiler is a nifty little class that assembles data from CI's database class and CI's controller class and gives you a pretty thorough view of what's going on. Unfortunately it's not going to work in isolation, it's tightly coupled with the rest of the framework, and afaik there isn't a simple alternative that you could plug in into a legacy ...


2

I don't use CodeIgniter, but as a Rails developer who used to just use phpMyAdmin and now uses migrations I'd say the primary benefits are: It's an easy way to port the code to a different workstation. Instead of having to dump the SQL file and import it into the other workstation, you just run the migrations. It allows you to keep your database schema in ...


2

Active Record is just a CRUD pattern... it maps tables and columns in a database to corresponding data structures in a programming language, and provides Create, Read, Update and Delete mechanisms. It has little to do with business logic, which is what you're describing. Every method is a "magic" method, according to your colleague's interpretation. A ...


1

How about public function bar() { if (notLoggedIn) // display error page else // perform authorized action } OK, so it's not very sexy, certainly not as fancy as decorating the methods with some thing, but it does have the virtue of giving you full access to the database for authentication purposes, which is more than can be said for, ...


1

Based on your drawing, it seems like there should be a model called by your controller that deals with talking to Google, getting the results back, formatting it for your app, and then that is sent to controller ready to go. In other words all the google specific details would be in that model. same for trello. that way if you need to add more apis to ...


1

There's a third option, start by writing your tests. It's the better option, and it's not specific to MVC. If you do start by writing tests, then the next step depends on your approach to MVC: Fat controllers / skinny models Your controllers do all the heavy lifting, while your models are essentially POPOs, tasked with maintaining state between requests. ...


1

This is what I do too. The simplicity of the code for checking authenticaton in the construct is more favorable to me (the construct is not too fat either). I check the minimal permission required in the construct and individual permissions in the individual methods. If all the method of the controller require same and only minimal permissions, i just ...


1

I tried to come-up with my own explanations, but i found a really comprehensive post in the middle of compiling my answer. Hopefully you will find more than you asked in this post - PHP ACL implementation Edir: Basically, idea behind the post suggest to use use decorator pattern (look at Wiki for more info). In simple concept this pattern recommend to take ...


1

One of the fundamentals of programming is "don't reinvent the wheel." If a framework has code that you would otherwise implement yourself, by all means use it so that you can focus on your application as a whole. However if you don't like the implementation, then you put your php knowledge to work and flesh out your own alternative. That said, if you're ...


1

I also have struggled with learning Rails and even bought a book to help learn it. The book didn't help at all (the book was Learning Rails Live Edition) and in fact turned me off to Rails even more (a lot of the code from the book didn't work and installing things such as Restful Authentication turned out to be a hassle and a half and eventually made me ...


1

Unless your webhost did something to cripple PHP, you do have SQLite support. Thats built into PHP5. That only requires the ability to read/write to local files.


1

Unless the db schemas are going to be different between the different sites but the codebase is going to be the same, IMO it doesn't really make sense to partition on databases but not code if you're going to need to do it for more than say 10 sites. I think the Django framework has an interesting approach where they define site ID's in a database table ...



Only top voted, non community-wiki answers of a minimum length are eligible