Trongate Docs
switch to dark modeswitch to dark mode
»
»
A Few Words About Coding Style

A Few Words About Coding Style

Throughout this documentation, you’ll see a lot of code that looks like this:

function hello_world() {
    echo 'hello world';
}

For some developers, this style of coding may seem unusual or even incorrect. There are lots of PHP developers who prefer to write their functions/methods like this:

public function helloWorld(){
  echo 'hello world';
}

Or this:

public function helloWorld()
{
    echo 'hello world';
}

Whatever you're doing:

Keep doing it!

The Trongate Framework offers a unique and refreshing perspective on coding styles.

Code In A Way That Makes You Feel Good!

This is not a statement that's made lightly. If you happen to be a developer who likes to write PHP code in a style that is in alignment with the PHPFIG guidelines (for example) then that’s fine. It’s good to continue to write in that style. On the other hand, if you have another coding style then that’s okay too, as long as it’s logical and it makes sense for you.

This documentation favours:

  • snake_case for file names and folder names
  • plural names instead of singular names
  • tabs made up of four space characters
  • avoidance of unnecessary method type declarations (e.g., 'public')

There are explanations for all of these decisions.  For example, snake_case has less room for ambiguity than camelCase.  Avoidance of unnecessary method type declarations means less typing and (hopefully!) an increase in productivity.

Guess what?

It's not really that important!  Don't worry about it!  

Did You Know?
On the Trongate Desktop app, you can modify the style of code that gets generated.  There are three coding styles to choose from.  They are:

  • speed coder
  • old regime
  • code like Brad

Relax!  You're using Trongate

There is an assumption within some parts of the web development community that trivial matters to do with coding style (for example, where curly brackets are positioned) has a dramatic and mission-critical impact on web application stability and reliability.

The truth is, application stability and reliability can be more readily achieved by making smart decisions to do with overall application architecture - not by fussing about trivial matters like the positioning of curly brackets or participating in 'tabs vs spaces' debates. Any developer worth their salt will not be confused because of a few more spaces or the positioning of some curly brackets!

Furthermore, Trongate is a ‘truly modular’ framework which means that applications are made up of self-contained modules that can be quickly bolted together – rather like a Lego model. Trongate’s unique architecture makes it very easy for developers to collaborate on big projects – even if they have different coding styles.


HELP & SUPPORT

If you have a question or a comment relating to anything you've see here, please goto the Help Bar.

 
×