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
- 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
- Wireframes: Make wireframes of all the screens using some tools like Pencil Project
- HTML Prototype: HTML Prototype needs to be build with dummy content which will give us the idea how the project will look like
- 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
- 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
- Default error pages: 404, 500 error custom pages to be created according to theme style
- 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.
- Setting page: Administrator should be able to choose
- if error should be logged or not
- If error should be logged in database or file system
- Should error log of e.g 30 days before should get cleared automatically
- Button to clear error log
- 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
- 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.
- Disable debugging: In live environment debugging should always be disabled
Audit Log
Every single click, action, event in the system has to be logged.
- Setting page: Administrator should be able to choose
- if audit log should be logged or not
- If audit log should be logged in database or file system
- Should audit log of e.g 30 days before should get cleared automatically
- 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
- Daily code needs to be pushed to Git.
- 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
- www.codeception.com
- www.php-fig.org
- http://plugins.netbeans.org/plugin/34676/php-apigen-api-documentation-generator
- https://netbeans.org/kb/docs/php/screencast-phpdoc.html
- https://validator.w3.org/
- https://jigsaw.w3.org/css-validator/
- https://github.com/squizlabs/PHP_CodeSniffer
- https://github.com/FriendsOfPHP/PHP-CS-Fixer
- http://beginner-sql-tutorial.com/sql-query-tuning.htm
- http://travis-ci.org/
- http://scrutinizer-ci.com/
- http://styleci.io/
- http://www.squizlabs.com/
- https://try.crashlytics.com
- https://firebase.google.com/docs/cloud-messaging/
- https://source.android.com/source/code-style.html
- https://google.github.io/styleguide/javaguide.html
- http://geosoft.no/development/javastyle.html
- https://github.com/phpstan/phpstan
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