Coding Guidelines: Programmer’s Daily Bread and Butter

As we work in startup, we are under time pressure to release a lot of new features on time, features which do not have well defined requirements and the complexity of those features is often underestimated and we end up taking a lot of shortcuts / adding hacks to release such time sensitive features.

This may work for a short time, but over the period of time we realize that the same shortcuts that you took to release features quickly are now slowing you down. You can not scale and add new features on top of it, even if you do, they become quite unstable. In this situation you might want to take a step back and revamp/refactor you base system.

One of the easiest things that you can do to avoid this situation is follow coding guidelines.

Coding Standards

Well, what according to you is a good code? The simple definition could be: if it can’t be understood, maintained and extended by other developers then its definitely not a good code. The computer doesn’t care whether your code is readable. It’s better at reading binary machine instructions than it is at reading high-level-language statements. You write readable code because it helps other developers to read your code.

Naming conventions:

As the name suggests, it is a simple concept where you follow a specific naming conventions across teams. This becomes important when your team is growing and are solving problems on daily basis and pushing a lot of code every day.

camelcases vs underscore

This helps a lot when your team becomes big and a lot of developers are working on the same code-base. If you follow some fixed patterns while defining classes/functions/variables names, it becomes really easy for fellow colleagues to understand your code. This directly impacts delivery time taken by a developer to build/modify a feature on top of existing code. For example, let us suppose you want to define a time-stamp field in a database table, how would you name it ? If you have a fixed pattern like a “action_ts” or “action_at” for giving names then you can easily guess what could be the field name in the schema. If its a created time-stamp then it could be either “created_at” or “created_ts”. You do not have to go and check every-time you writing any logic over different database tables.

Function/Module/API writing (Size and Purpose)

Simplicity and readability counts. It’s always better to write to concise code than a messier one so that if any other developer is also looking at it who has no idea, should get what exactly it is doing. Not more than max 10–15 lines. Jenkins is considered as one of the greatest implementations, and has average function length of 2 lines.

A function/module should only do ONE thing and should do it NICELY. By following this, code becomes modular and it helps a lot in debugging. You can solve the problem better and debug faster when you know where exactly it’s coming.

When you are developing features over an established products, more than 50% times, new requirements are of the nature which you can build on top of existing code. In such cases, you can ship those requirements really faster and stable if existing code-base is modular and stable. Writing library functions a savior. There are countless advantages of writing a library code. It avoids code repetition, no surprises when it comes to response formats and of-course code re-usability.

Exception/Error Handling

Unknown errors are real pain in developers life. It’s always better if you know probable exceptions and errors in code in advance. But that is not the case always. Irrespective of all this, you definitely do not want your end-users to see unexpected errors on their screens.

When you have different micro-services and bigger development teams, if you follow standard response formats for across APIs and standard exceptions then there will not be any surprises in production. You can agree upon one format across all the services. Every API can have certain ‘response_data’ and standard set of error-codes. Every Exception will have an error-code and a message. Message could have variation viz, tech specific message and user facing message.

Writing test cases:

If you want to have a good night sleep, then you better have thorough test cases covering almost all aspects of your code. The best way forward with building test cases is at requirement stage only. Whenever a requirement comes, products managers discuss it with developers as well as QA. Both teams start preparing for possible use-cases and test-cases.

A testing unit should focus on one tiny bit of functionality and prove it correct. Each test unit must be fully independent. Each test must be able to run alone, and also within the test suite, regardless of the order that they are called. The implication of this rule is that each test must be loaded with a fresh data-set and may have to do some cleanup afterwards.

Automation plays an important role here. What else is needed for stable product where you have all test cases covered and running at intervals automatically, giving you a report of the all functionalities. Also, whenever you are adding/modifying code, you make sure either you write new test cases or modify existing ones.

coding

Code Reviews:

This one thing save lives, trust me! Every team can benefit from code reviews regardless of development methodology. Initially it takes time if you do not have a procedure setup of doing code reviews, but eventually it becomes a habit. Code review should be one of the core development steps.

Code review generally is about:

  • Does the new code conform to existing style guidelines?
  • Does the written piece of code covers all the use-cases specified in the requirements and has relevant test cases written ?
  • Are the new automated tests sufficient for the new code? Do existing automated tests need to be rewritten to account for changes in the code?

There are several advantages of this process such as –

Code reviews make for better estimates: Estimation is a team exercise, and the team makes better estimates as product knowledge is spread across the team. As new features are added to the existing code, the original developer can provide good feedback and estimation. In addition, any code reviewer is also exposed to the complexity, known issues, and concerns of that area of the code base. The code reviewer, then, shares in the knowledge of the original developer of that part of the code base.

Code reviews mentor new joiners: Code reviews help facilitate conversations about the code base between team members. During these conversations, team members share their views and new alternatives of doing things.

Code reviews take time: It’s an incremental process, where it takes time initially but as your code-base grows, it ensures, you are always pushing verified and tested code.

Hidden truth about code reviews: When developers know their code will be reviewed by a teammate, they make an extra effort to ensure that all tests are passing and the code is as well-designed as they can make it so the review will go smoothly. That mindfulness also tends to make the coding process itself go smoother and, ultimately, faster.

As a fast growing company our self, these set of guidelines have helped us a lot in shipping stable features on time and helping to increase a healthy learning environment.

Source:- Capital Float’s Medium Blog

More Related Posts

Card image cap
Improving the Profitability of Private Schools

Intimidated by the long-drawn process of getting a loan approved from conventional sources such as banks and traditional NBFCs, schools in India often discard the idea of borrowing funds for improvements on their campus. They try to make the most of their limited available funds, even if it means some degree of compromise on the quality of upgrades they had planned for the school.

Such an approach does not bring any benefits in the long term. In some cases, it may even backfire. For instance, if a school purchases low-quality furniture due to inadequate funds, which causes discomfort to students/staff using it for 6-7 hours every day, it may not only tarnish the school’s reputation but also cause serious health problems for the users.

What comes as a relief is that school loans are available on easy terms from FinTech companies that are essentially NBFCs but have a streamlined digital lending model for quick disbursal of funds. From a loan for buying school furniture to any other loan for school development, they can provide funds within a week of application receipt. The application needs to be substantiated by only the soft copies of a few documents verifying the credibility of the school.

So what are the benefits of leveraging a quick school loan from such a source? Does it lead to more profitability for the educational institution?

Here’s how the benefits of these loans unfold:

Enable improvements in infrastructure and purchase of new teaching equipment

FinTechs can provide a loan for school construction which helps the borrowing institution to divide students of the same class into different sections. With this, teachers can give more attention to each student, and the quality of teaching improves. The building structure can also be expanded when a school decides to admit more students or has to advance its existing classes to higher grades.

Schools can also take a loan for smart class facilities that are sought in every private school today and have become significant for a generation growing in the digital age. Other areas where a school loan can be used include furbishing of labs and computer rooms, purchase of games supplies and investment in vehicles for transportation services.

Invigorate interest in admissions

The most direct impact of bringing improvements in school facilities is a rise in the number of students who want to be a part of the institution. While senior students can understand the benefits of moving to an optimally planned school on their own, the parents of younger children who join an academy from kindergarten will also try to place their children in such a school. Provision of excellent facilities and keeping pace with new techniques that transform the learning environment is a natural incentive for more admissions in a school.

The good repute of a school can instantly attract students who move to the city due to their parents’ job transfers and have to find an educational institution in minimum time to avoid loss of studies in an ongoing academic session.

Collection of more fees

More admissions imply higher fee collection, and constant increase in this amount eventually leads to increased profitability for schools. A school loan taken to add new facilities and create better learning experiences has multiple benefits for schools that aim to be the leaders in delivering quality education services. Evidently, the increase in their earnings also helps them to repay the borrowed fund.

Whether you need a small loan for school furniture or up to Rs. 50 lakh to finance any development process in your school, Capital Float ensures that you get it most conveniently. Visit https://www.capitalfloat.com/school-loans to apply for your fund today.

Oct 24, 2018

Card image cap
Top Reasons Why Unsecured Business Loans Are Becoming Popular

During the lifecycle of a business, there are times when the inadequacy of working capital threatens the flow of operations and hinders growth. Traditional lending institutions in India such as banks rarely provide assistance in such situations, as they generally demand collateral, which small business and young entrepreneurs may not possess. An unsecured business loan can take care of routine business expenditure such as maintenance of machinery, making payments to suppliers and purchasing raw material. It can also be useful for business expansion activities such as purchasing new machinery or expanding premises.

Moreover, all small and medium enterprises need funds to seize new opportunities for growth, and the window for such opportunities is usually small. In such a scenario, there is a need for quick access to funds. The loan repayment schedule also needs to be synchronous with the expected revenue flow from a business venture. Hence, an unsecured business loan taken from a FinTech company works best for them, as it is disbursed much faster than a loan from a bank. Further, these FinTech companies ensure that an SME is always at ease while paying the loan instalments.

Unsecured loans are turning extremely popular amongst small businesses communities. These are a few reasons why.

They help strengthen the business finances

A suitable business growth opportunity can present itself at any time, and therefore a small business needs to have access to adequate resources at all times. In case the cash flow situation is imperfect or there is a working capital requirement to meet routine business expenses, it helps to take an unsecured loan for a short period until the situation improves. This ensures that a small business will never find itself at a disadvantage when a new opportunity presents itself. Such loans from FinTech companies do not come with any prepayment penalty, and their tenure can vary from a few months to a couple of years.

Faster approval and quick access to funds

The digital revolution and the subsequent development of IT systems and processes have led to the rise of new age FinTech companies over the past five years. FinTech companies in India follow a completely different approach to the unsecured business loan market, as they use innovative technologies to profile, design and disburse loan products for small businesses. Even the application for an unsecured loan can be made online or through the mobile app, and all supporting documents such as bank statements, tax statements, previous loan statements, KYC documents, business receivables and other relevant documents can be uploaded in digital format. The use of advanced analytic techniques allows these companies to process a loan application within minutes. Upon approval, the loan amount is transferred to the borrower’s bank account within a few working days.

An unsecured loan product for every business

Extensive use of technology enables FinTech companies such as Capital Float to design new loan products that are meant to fulfil varying business needs. The loan product, Term Finance, is meant for small businesses that have been in operation for more than two years and have been doing good during that period. Such businesses can take business loans from ₹1 lakh to ₹1 crore for a duration of a few months to three years.

Supply chain finance is meant for small businesses that have blue-chip companies as customers. Such businesses can take up to 80% of the pending invoice value as an unsecured loan. The loan can be repaid either as monthly instalments or at one go upon receiving payments from the customer.

Unsecured loan products designed to support digital economy

Online Seller Finance is another loan product from Capital Float that is designed for businesses that generate revenue through e-commerce marketplaces. It provides up to 200% of the monthly sales volume as advance to such businesses. This money can be used to accelerate business growth online.

Similarly, merchants that receive the bulk of their payments through PoS terminals can avail up to 200% of their monthly card settlement value as advance through a customized finance product called Merchant Cash Advance. The loan amount can be repaid through the deduction of a fixed percentage from card settlements in the subsequent months.

Get loans on the most favourable terms

Capital Float offers loans at the most competitive rates. These unsecured loan costs can be brought further down by choosing the right loan product. Capital Float charges a flat 2% processing fee for all their loan products, and there are no other hidden charges. Another great benefit is the flexibility offered in loan repayment, which is linked to the business receivables.

Indeed, new age technology driven FinTech companies have eased the pain in procuring funds from the unsecured loans market in India, and small businesses can look up to them as a partner in their business growth.

At Capital Float, we fully understand the business challenges faced by small businesses and have therefore designed the unsecured loan products in such a way that businesses can focus more on business growth rather than on worrying about getting business finance. Our customised plans ascertain that you get just the right product that suits your unique need.

To find out the product that best suits your business, click here.

Oct 24, 2018

Card image cap
A digital prescription for the pharma industry

Must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness.

Oct 24, 2018