CodeIgniter Forums
Best way to project, plan and structure an app with CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Best Practices (https://forum.codeigniter.com/forum-12.html)
+--- Thread: Best way to project, plan and structure an app with CI (/thread-74184.html)



Best way to project, plan and structure an app with CI - Corsari - 08-15-2019

Hello

from which side do you start building and app?

I mean
given that you already know which the users areas and interactions are and also you already have structured the DB,

do you start with empty controllers and views setting up the navigation and routes?
Or what?

Thank you for sharing your approach

Robert


RE: Best way to project, plan and structure an app with CI - fmertins - 08-15-2019

Hi, usually I start with weak (simple) entities from the database, creating its models and domain classes.

Then I start creating controllers with empty methods (future implementation) to build like a skeleton, in other words, what will be the controller responsibilities, or "actions".

Then views... HTML markup

Oh, along with these activities I'll certainly create some core files like MY_Controller, MY_Model and MY_Log, because I have own stuff inside these files.


RE: Best way to project, plan and structure an app with CI - php_rocs - 08-15-2019

@Corsari,

That's a loaded question. There are so many approaches that can be taken. I like to have complete documentation/screen flow of how the whole application will function (including features) and work (this also includes the baseline database and all tables).

I'll try not to get to wordy...

One approach I take,
A. I create all the screens in html/js/css (I usually use a free bootstrap theme such as https://github.com/ColorlibHQ/gentelella )
- I then determine the default screens and how I can make useful reusable view parts (i.e. header and footer views).
B. I then determine the security approach and levels that will be used throughout the system (user/administrator access)
B. I then determine how I will create models. I prefer to create models to do specific things that can be reused throughout the system.
- for example...Userexist()
C. I then begin to code moving forward with the first screen and attaching all necessary code behind.


RE: Best way to project, plan and structure an app with CI - InsiteFX - 08-15-2019

Likewise similar to php_rocs I use a top down approach working from the screens
back down into the app step by step defining the problems to be solved.

The screens can tell you a lot about the app for declaring variables etc;

These will also map into your models and controllers.

keep in mind KISS and DRY (Keep it simple stupid and do not repeat yourself).


RE: Best way to project, plan and structure an app with CI - php_rocs - 08-15-2019

@InsiteFX

EXCELLENT POINT ABOUT KISS and DRY!!!


RE: Best way to project, plan and structure an app with CI - jellix - 09-04-2019

Very good thread!

I‘m not sure how to start the best way. As many people would say ... it depends ;-)
But I would say ... first I create the header file to implement bootstrap, jquery and custom webfonts.
Then I create the most important and nessecary model(s) and controller(s) < first model, then controller to load a first view and provide data to it. Mostly the view just displays a list of loaded items.
Then I build another view to show details of one item. Often this is a form so that I could build some edit functionallity extending to CRUD (create, read, update, delete).
After that i want to make it look nice. So I tweak the css (scss). Now ... display-filters for the list. So some jQuery scripting :-)
If there should be users I would build the login now, also with session-management. Just the login, not the whole registration and forgot-password-stuff.

Before the software grows, I also try to build repeating view-parts to be flexible.


RE: Best way to project, plan and structure an app with CI - John_Betong - 09-04-2019

My approach is top down and to create the basic tree menu system ensuring stylesheets and JavaScript files are all included.

I also use this common footer which consists of two w3.org validation service links. This dynamic script saves opening, copying, pasting, testing, the same links umpteen times.

PHP Code:
<?php 
declare(strict_types=1);

  $url    $_SERVER['REQUEST_SCHEME'
          '://'
          $_SERVER['SERVER_NAME'
          $_SERVER['REQUEST_URI'
          
  $vEnc   urlencode ($url) ;

# FLOAT RIGHT
  $vCss   '<a href="'
          .   'https://jigsaw.w3.org/css-validator/validator?uri='
          .     $vEnc
          
.   '&profile=css3svg&usermedium=all&warning=1&vextwarning=&lang=en"'
          '>CSS: Validator'
          '</a>'
          ;

# FLOAT LEFT
  $vHtml  'https://validator.w3.org/nu/?doc=' .$vEnc ;
  $vHtml  '<a href="' .$vHtml .'"> HTML: Validator </a>' ;
  

 
/* style.css 
  .bot {border: solid 1px #ccc;}
  .fll {float: left;} 
  .flr {float: right;}
  .fss {font-size: small;} 
  .ftr {position: fixed; left:0; bottom:0;} 
  .tac {text-align: center;}
  .w99 {width: 100%;}
*/

// PHP STRINGS HEREDOC Syntax
  echo $ftr = <<< ____EOT
    <p> <br> </p>

    <div class="ftr tac w99 fss">
      <b class="fll"> 
$vHtml </b>
      <b class="flr"> 
$vCss  </b>

      Wonderful place for a footer
    </div>  
____EOT; 



RE: Best way to project, plan and structure an app with CI - demyr - 09-05-2019

Before everything I create a new Word file to note down & follow the "to do list" of the project. When I complete a task, I strikethrough it, I also write down any link of any forum help or a link of a video etc. Then the work takes control of me and the work itself in a proper way.

And I continue by doing it one by one, seeing the result of each section, of course by copying some parts from the previous jobs. This might lead to getting stucked to a point until you solve it. (Because I spend a lot of time searching for a solution. I rarely ask for help)