Code you never write before
Being a Software Engineer with more than 6 years of experience, I've observed lot of things while working on projects. Since I'm an Android developer and use Java as programming language. To accomplish the task has always been my goal. To just write the code is easy but to write the good code might not be. I want to share with you my 10 rules of writing good code.
1) First think then write – Developer life has always been busy with lot of work pressure. I've seen many people who write the code just to complete their tasks without thinking the impact and without following the standards and best practices. Before writing the first line of the code, you should understand what it will be doing. To solve any issue, there could always lot of solutions but try to choose the best way to get it done.
2) Code Reusability and Optimization – Code reusability has always been worthful. I've seen lot of times people do the common mistakes to write the same code again and again so the result was more irritated and frustrated for other developers who are working on the same project or reviewing it. Minimize the number of lines of code should always on your top priority.
Never write same code twice.
3) Architecture first – I saw many people who start the project without thinking and creating it's architecture. Some says we don't have time for architecture and 99% of them got big problems during project because of such thinking. Architecture is the key root of every project which should be more generic as much as possible. Writing code without thinking of its architecture is useless in the same way as dreaming about your desires without a plan of achieving them.
4) Follow standards – When talking about the code, always follow the trends and standards. I saw many people who don't follow the proper rules, they just start coding which will never ends. Every language has standards we need to identify it.
If you follow the standards coding style, It will be easier for you and also for others to understand your code easily.
5) Meet deadline – Every project has a deadline on which the project ends. Some people tried enough but couldn't meet the deadline. Sometimes people stuck in a task which could take lot of time to be done. In that case, people might not follow the coding standards and best practices in order to just meet the deadline. Best practice is to meet the project deadline without sacrificing the coding standards and guidelines. This will be the SMART WORK as expected.
6) Prioritize tasks – Prioritize each of your single task as per schedule. This is needed and essential way to complete the project within the deadline. Priority always makes you comfortable to complete your task in a targeted time you decided for it. You should know what you have to do today, tomorrow and day after tomorrow. Always do your tasks first which are never dependent on someone else, dependent tasks should be consider later.
7) Comments – Comments in code not always been required. Good code should be understandable without a line of comments. But what to do to save time for new developers? Write simple inline documentation describing what and how method work. This will save much time for understanding and even more. It will give people more chances to come up with better implementation of this method. And also it will be good start for global code documentation.
8) Code Review – Code should always be review first. I saw people who don't review the code which must be priority. Without review we can't identify the common mistakes we do when writing the code. There is always learning and we learn from our mistakes so we should follow it religiously.
9) Project Ownership – You're responsible for the project you're working on, until it's deliver successfully to its client. Each employee who are part of the project has equally responsible. Sometimes people didn't take project's ownership so in result, the project couldn't deliver on time and organization suffers. So each and every employee should be honest with the project. People should work on weekend if required so we can meet the project deadline.
10) Test before launch – There are some basic and essential software testing steps like unit test which every software developer should perform before showing someone else their work. Unit testing is not something you will see in an end product. It's a type of testing performed during the coding stage. The goal of this basic testing is to detect the obvious bugs that jump out immediately. Otherwise, you get into an expensive and unnecessary cycle of having to describe the problem to the developer, who then has to reproduce it, debug it, and solve it, before trying again.
Good stuff, keep it up. Write more on rapid development for android