Skip to content

Programming Standards

Bhanu edited this page Jan 30, 2019 · 1 revision

Overview

While programming we need to follow guidelines, here are some guidelines.

These guidelines are in general for PHP, HTML and Android development.

"Give me six hours to chop down a tree and i will spend the first four sharpening the axe" - Abraham Lincoln

Requirement Manual

Planning, organisation and teamwork are key to success.

Before starting any project following should be done

  1. Requirement manual: A detailed requirement manual needs to be prepared explaining the project/module, flow and all the screens/modules, Screenshots should be put in this manual
  2. Wireframes: Make wireframes of all the screens using some tools like Pencil Project
  3. HTML Prototype: HTML Prototype needs to be build with dummy content which will give us the idea how the project will look like
  4. Database design: Database needs to be designed and put on paper with explanation
"Here lies the difference between productivity and busyness. Don't just get busy. Get busy doing the RIGHT THINGS. What do you need to get busy doing today?"

Exception handling

  1. Try Catch Block: User try catch block in all the pages in the program, Pass the system default error message to the notification block on the user panel. If you can imagine the cases for exceptions, change the error message being passed to user so the user can understand where i the mistake
  2. Default error pages: 404, 500 error custom pages to be created according to theme style
  3. Disable debugging: In live environment debugging should always be disabled

Error Logging

We are using Bugsnag to track bugs/error logs. Make sure in your code Bugsnag is integrated and Try Catch block report is sent to Bugsnag wherever required.
  1. Setting page: Administrator should be able to choose
    1. if error should be logged or not
    2. If error should be logged in database or file system
    3. Should error log of e.g 30 days before should get cleared automatically
    4. Button to clear error log
    5. Email Error log: Admin can choose if error log can be emailed on daily basis or as and when it occurs, Admin can also define email address where the error log should be emailed
  2. Default error pages: 404, 500 error custom pages to be created. If for any reason bug/exception occurs in the code client should see custom error pages and at the same time bug should be reported to Bugsnag.
  3. Disable debugging: In live environment debugging should always be disabled

Audit Log

Every single click, action, event in the system has to be logged.
  1. Setting page: Administrator should be able to choose
    1. if audit log should be logged or not
    2. If audit log should be logged in database or file system
    3. Should audit log of e.g 30 days before should get cleared automatically
    4. Button to clear audit log

Test Driven Development

Search on Google about test driven development, read more about it.

Unit Testing

Use PHPunit, JUnit test, don't miss this at any cost, no matter how much time consuming it is.

Testers will not test the code which doesn't have Unit test cases.

Codeception - PHP

Use Codeception wherever you can. Details https://codeception.com/for/laravel

This is something currently we are not using but would like to test and use in the future

PHP Stan

Details: https://github.com/phpstan/phpstan

This is something currently we are not using but would like to test and use in the future

Dusk Cases - Laravel

Write Dusk cases in Laravel

Manual testing

Manual testing to be done by tester after unit testing is complete. It's the duty of developer to get his code tested by tester

Test cases

Test cases to be written before starting development. Developer/testers needs to write these cases in consultation with each other

Codacy

We use Codacy for all code reviewed https://www.codacy.com/ Every single line of code written has to be reviewed by another team members, no code should be committed and made part of release without review at any cost. It is duty of developer to get his code reviewed.

PSR/Fig Standards for PHP

Use PSR/FIG Standards

HTML/CSS Standards

All HTML/CSS should be W3C validated

GIT

  1. Daily code needs to be pushed to Git.
  2. We use Github

Database design

  • Primary Key: Primary key to be set for every table
  • Foreign Key: Wherever required foreign key relationship should be set
  • Database design: Database design to be completed before starting programming/development
  • Database ER Diagram: ER diagram to be made once Database design is complete
  • SQL Tuning or SQL Optimization: Optimise the query, avoid using select * statements
  • Laravel supported DB: The code should work on all Laravel supported databases. Always use Eloquent in the code, don't write mysql or database specific query in the code
SQLite database used in Android

Code Commenting

  • Human Understandable: Comment Should be human understandable
  • PHP/Android/Java Standards: Code commenting standards/keywords should be followed
  • Documentation: After the project is completed a developer documentation should be generated using various IDE plugins from these comments.

References

Software

We prefer using following software
  • Netbeans IDE
  • Wamp/AMPPS
  • Adobe Dreamweaver or Brackets
  • SQLYog
  • MySQL Workbench
  • Composer
  • Adobe Photoshop
  • Filezilla
  • Github Desktop or Source Tree desktop GUI client
  • Android Studio

Installation and Upgrade Guide

Administrator's Guide

Agent's Guide

Email Integration

Release & Upgrade Notes

Known Issues

Contribute & Feedback

Knowledge Base

Third Party Integration

Plugins

API

Clone this wiki locally