Welcome Guest, Not a member yet? Register   Sign In
Codeigniter class design best practice ? ORM and HMVC
#1

[eluser]ahmed.samy[/eluser]
I have small team with 3 people including me, me the main developer and Business analyst and another junior developer

basically I am working with Business analyst and in system design and yet will be coding a lot,

We finished our BPM and working on UML right now

My biggest challenge is finding the best practice to generate classes/interfaces or even manually design it in Codeigniter

Dunno how to start on this i just need a small push to the right way

-Shall i use ORM and keep models as my business logic
-or i can use model as pure business logic just like old fashion classes style
-How the native old classes as business logic layer can be presented in codeigniter model or libraries or combination of both
-I searched around and i think i will be using HMVC is that ok ? or should i used HMVC + ORM doctrine to achieve more loosely coupling , not sure if it will be overkill
-I also though to have core business connected to REST API in case of expanding the project on mobile apps for example which might happen in near future and easier to integrate with other external providers


My system is a clinical system has the below modules:

-Task management
-Patient data management
-Business process for every service (milestones with different business rules ...)
-Integration with Trello, Google Calendar and Google Drive and may be Google talk
-Many type of access level according to modules

#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

First of all, I am a PHP hobbiest. I do not do this for a living. I've been meaning to try ORM and HMVC for a while, but I just never found the time (and I know I should).

I have noticed, however, that most of the serious developers I know of, tend to favour fat models and skinny controllers. I don't think HMVC and ORM are overkill at all for a project of the scale you're talking about, and keeping your business logic within your models is definitely a good thing.

Hope this helps.
#3

[eluser]Rok Biderman[/eluser]
I agree wholeheartedly. HMVC really helps with and I regard it as a integral part of Codeigniter. You are of course in danger of fragmenting too much and loading each module increases execution time, but the small decrease in performance is well offset in modularity. I hate repeating myself and like having one point of failure.

There is a lot of decisions in there that can't really be answered without knowing a whole lot more and some are just a matter of your personal preference. The decision to use or not use ORM is yours alone, use what you're comfortable with. I seem to be getting by just fine with base model to handle the basic crud-ity and validation, doing else by myself (feel free to look into Jamie's or Alexander's base model, those two look best to me).

If you want to keep some portion of sanity regarding security and multilevel access I'd highly recommend using separate controllers for different access types and extending them. Actually, there is an app just published that I looked into that uses application design which I find reasonable. Jesse, the guy who develops it, also uses his own version of base model, so you can get a glimpse of what that looks like. Also think about integrating tests. It's always faster in the long run and with sensitive medical data, people get upset even faster.

Unfortunately I can't show you mine 'cause most of my clients were paranoid (I'm not freelancing anymore), but I can offer some suggestions over PM if you'd like some additional pointers.
#4

[eluser]ahmed.samy[/eluser]
Thanks Rok, I agree with you in ORM point, actually I mnot comfortable with ORM and never used it before, it's nice to out of the comfort zone but if i used ORM and HMVC for first time in real project that will be too much out of comfort zone we have to get familiar with modular pattern first i think Smile

About extending controlller to get more permission access level that for sure what i was planning to do Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB