Design Logic Help Requested |
Intro disclaimer: I am struggling with the overall design logic for a large application that I am solely in charge of building at my current workplace. (Please keep in mind that I have never considered myself a "PHP developer" and my boss knows this! When put in charge of this project, I knew it would be a great opportunity to learn the principles of developing a full application, but I find myself struggling with "the basics" that I never even realized I didn't know!) I am not an expert in any area of programming, and most definitely consider myself a novice here, so any constructive criticism is welcome. This being my first ever post to a programming forum asking for help, I'm hoping that my broad question will lead to a more refined discussion and some concrete options of things I can consider and places I might find good examples.
Broad overview: As one of our (the company I work for) products, we sell mobile applications built on a preconfigured (pre as in...before I came on board) "platform" which is basically one big mobile application being utilized as a template for branded versions of said template. I am tasked with building a web application which will #1) give the clients the ability to make changes to the specifics of their branded applications, and eventually #2) let the developers make more advanced changes to those same applications and/or "build" new instances of that template...and possibly in the far future #3) allow clients to build new instances of the template themselves. Stretch goal: I really want this application to be highly scalable. For instance, I'd love to be able to deliver this application fully functioning, and let them know that "hey, we can also utilize it for future platforms without having to reprogram an entire web app from scratch!" Some logic 'nitty gritty': This is where I'm finding that I get lost in the crazy number of options there are out there for building a php application. So, what I need is a program that will:
You would need to break the application down into like object modules then break them down into smaller manageable objects
Keep breaking it down until it doe's not make sense to break it down any more. A good way of doing this is to start with your screen output, it will tell you what variables etc; You will need. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
* Go on youtube and search for 'clean code robert martin' . he's also known as 'uncle bob'. his lectures on architecture design are timeless. his examples are mostly in java but it actually reads almost exactly the same as codeigniter.
* Naming is very important and you should not hesitate to rename things to make them more clear. use folders to help organize your controllers and models. * Think in terms of your users and their 'roles' - not data objects. Controllers serve people using them for a specific task. Do not mix roles in a controller. If you need to be logged in to do a task - then that should be in a separate controller that only admins have access to versus a controller that is used for generating a public page. * Build in your controller and then push your code to models. Models can be used for much more then database interaction. Models can call other models. Models should not do too much - its better to have many small well named, well defined models then a few models that do too many things. * Views are like scrap paper. Don't do anything important in a view. No application logic. No checking if someone is logged in. * Get PHPstorm IDE for development. Your company can buy it but they also have monthly payment plans. Theres a thread on this board about the autocomplete file that makes it easy to use with codeigniter. You will have to dedicate some time to learning it but it will save you so much time over the long run. Especially if you are working on a large application. * You don't have to put everything in one application folder. You can have folders on your server like "alpha1" "alpha2" "beta" etc that point to different application folders.
@mwebdesign
Do you use CodeIgniter in your platform at all? You have mentioned "a bunch of javascripts", the front-end framework vue.js so far. I wonder whether here is anybody capable to help, we talk about CodeIgniter mostly. Anyway, I think, you are at risk to face a disaster. I serious company should not put you under such a big challenge, quite bigger than you are. I faced a similar situation ago, it took me about 3 years to get rid of the old code. You need a plan and an estimation on what time and workforce this plan would take. You need understanding and support from your company. As a minimum they should have objective knowledge about the current code quality.
(07-13-2016, 11:09 AM)cartalot Wrote: * Go on youtube and search for 'clean code robert martin' . he's also known as 'uncle bob'. his lectures on architecture design are timeless. his examples are mostly in java but it actually reads almost exactly the same as codeigniter. I love these quick pointers! Along with the good advice from InsiteFX, I feel like I'm starting to have at least an idea of some solid specific things I can do to start making some positive movement forward. Thank you!! I think a lot of the problems I've come across so far are due to the fact that I purchased a codeigniter-based program from code canyon, and utilized it as a kind of "starting template"... Many things went great taking this approach...but many other things have gone very badly and have had me writing code to work around the things I can't figure out (from the 'template' code). Anyway, I have learned a lot by doing it this way, but I think it would probably be a good idea for me to rewrite the things I need from the bottom up in a fresh ci environment. I actually already have PHPStorm ...i just haven't been using it for this project because the 'template code' I have been using looks like a huge mess of warnings when opened in PHPStorm.... I suppose that should've been a big hint huh?
(07-13-2016, 11:25 AM)ivantcholakov Wrote: @mwebdesign Oh yes, I'm using Codeigniter. I realized after posting my original post that I didn't really make that clear, so a very good question on your part! If you read my response to Cartalot, you'll see that I kind of "shot myself in the foot" by starting off with someone else's interpretation of a program, thinking it would help get me to my goal faster... Unfortunately, at this point, I think I need to take everything I've learned and start from scratch. I'm ok with this, but my work is really pressuring me for "something concrete". That being said, my direct boss is really on page with where I'm at in this situation. She's been very level-headed with listening to me tell her that the old code base is garbage and was cool with me starting from scratch. Many of the problems I've been facing are due to me trying just not knowing enough...me trying to find the "perfect solution" first and just spending too much time researching instead of writing code....or me trying to utilize others' solutions and bend them to be my own.
(07-13-2016, 11:09 AM)cartalot Wrote: * Get PHPstorm IDE for development. Your company can buy it but they also have monthly payment plans. Theres a thread on this board about the autocomplete file that makes it easy to use with codeigniter. You will have to dedicate some time to learning it but it will save you so much time over the long run. Especially if you are working on a large application. Hey @cartalot...I just read what I believe to be "the thread on this board about the autocomplete file" that you mentioned above. I saw that you contributed a autocomplete config file that was working for you. I've copied it over to see if it's something that might be helpful for me, but I thought I'd ask if you had made any significant changes/improvements to the file since posting it. Do you think your solution has any specific pitfalls I should watch for? Or have you found any other sources that you think work better? Also, in response to your final paragraph (which I seem to have missed earlier)...I know that CI documentation talks about moving the Application folder, but is there much about making a multiple application folder structure? Either in CI Docs or elsewhere that you know of? Of course, I can google this and that might answer my prematurely asked question, but if you have any input, I'd certainly take it in. Thanks again!
WireDesignz HMVC might be useful for you. You can keep all your separate apps in different folders (each with their own views and controllers).
Your 'main' app would just have to deal with permission to access, and calling the separate controllers within the HMVC framework. Will make testing much easier, keep separation for your apps and it is very robust once you get the hang of it. Building an app like this on the back of a codecanyon example is not a great idea, should definitely be doing this from scratch. You should also move the settings for each module into their own tables. Much easier to control that way. So module 'projects' reads 'project settings' from a projects_settings table. Much cleaner. My only advice from a job perspective is to be careful. Your desire for clean lovely code for good reasons may not be shared by your company if they already have code that works. They may be much more along the lines of 'if it aint broke dont fix it', rather than taking the full brunt of the blame for every limitation, bug or issue that arises in the future. Working with the disastrous code at least protects you from the point of view that 'its not your fault, it was how the code was designed in the first place'. And they may not be in a position to wait months and months for your version to come up to production level. Of course I do not know what your remit or job description is, but a plan moving forward might be to work on both, the live stuff with support, bug fixes and improvements, whilst developing the new version when time allows. It sounds to me like your company was never into making beautiful code if all this is a revelation to them. And your direct report, who is currently understanding and listening, may be saying all sorts of things behind closed doors with her boss. Good luck, Paul.
@mwebdesign
Have a look at this project of mine (The MIT license): https://github.com/ivantcholakov/starter...-edition-4 If you think that it could be useful, enable receiving private messages in your profile in this forum and send me a private message. I will give you for free source to a small CMS built on top of this starter. I think, it will give you an idea how you could structure your code with scalability in mind, without much talking. It would not fit exactly to what you need, some features you should port/write alone, but at least you will start at a higher level. But honestly, I still feel skepticism. I hope I am wrong.
@ivantcholakov
I agree, will be interesting to hear how it went or is going in three and six months time. That link you posted, wow, you have put so much work into all that. Quite impressive. That must have taken ages. |
Welcome Guest, Not a member yet? Register Sign In |