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
A digital prescription for the pharma industry

Pursues or desires to obtain pain of itself our because it is pain, but because occasionally can procure great pleasure.

Oct 24, 2018

Card image cap
Making SMEs Loans a Breeze With Capital Float – ProductNation

Interviewed by Kritika Prashant

Typically, choosing to finance the SMEs looking for working capital loans, is not easy. First, the SMEs have smaller ticket size. Then they expect quick service and have high operational costs associated with it. ProductNation interviewed Shashank Rijyasringa and Gaurav Hinduja who started Capital Float in early 2013, a digital finance company that serves the loan requirements of SMEs in India.

Shashank having worked with McKinsey and Bain, has a background in creating, and packaging financial instruments. Gaurav on the other hand had grown and sold his family business before they met at Stanford as classmates.

“We were looking to address financial inclusion. We observed how the fin-tech space was being disrupted in US and China, and saw the huge opportunity in India. With 48 million SMEs, second just to China, with 50 million, India needed lenders who would tailor their offering to the needs of the customers. The rate of interest by the banks was much higher than expected. Also, the loan disbursement ate up a lot of time. So this need was largely catered to by the informal sector”, says Gaurav.

Registered as an NBFC with RBI, they started with an instrument for invoice financing (building loan product against invoice of blue-chip companies). The duo gradually evolved their products to provide working capital loans for SMEs. They developed underwriting models which address the specific scenarios of the SMEs.

“There are 2 broad categories of sellers coming up on eCommerce portals. First are those who sell on platforms like Zovi and Myntra, where the sellers are also the manufacturers. Other category includes retailers who sell on sites like Snapdeal and Paytm. They generate a huge demand for loans available at short notice periods with minimum hassle. That is where we found our sweet spot”, shares Shashank.

Here are some experpts from the interview:

How did you overcome the problems of traditional lending?

SR: “Firstly, our experience came in handy. My in-depth knowldge of micro-financing, packaging and selling loan instrument meant we could build the right services. Gaurav with his experience of running a business out of India, knew how to deliver the services we wanted to build.

Secondly, we met with our customers to understand what their problems really were. To a small business owner, every hour spent off the floor is an hour wasted. We came up with innovative methods like allowing same day approvals and providing loan facility over phone and laptop. These businesses needed greater accessibility and straight-forward procedures. They wanted someone who could understand the value of their time.

Third, and definitely the most crucial point was that we adopted trial and error method. Like any startup, we didn’t know exactly how things would work. We were building our instruments in-house. So we had to fail fast and experiment quickly. With agile methodology, today, we can deliver new loan products in 2 weeks. A bank would take about an year to do the same.”

How is the policy environment evolving in India, with respect to your industry?

GH:  “The Mudra banks for refinancing are a welcome move. With 950 million Aadhar numbers issued, allowing eKYC, is it much easier to issue loans. The Digital India initiative to create better internet connectivity will help us reach a much larger customer base.”

They are leveraging the Indian stack to refine their instruments and are growing with it.

How difficult is it to get payback of loans?

SR: “SMEs are the most financially aware and responsible segment, since they always manage their finances tightly. Also, our screening process mitigates high risk customers, allowing us to cater to the needs in minimum possible time frame. So that’s not much of an hassle.”

What would be the 3 lessons you have learned from your journey?

GH: “1. Perseverance – One needs to believe that the idea would work, when no one else knows if it will. It is important to stick to that optimism and keep trying to find the exact fit.

  1. Strong fundamentals – From the first day, the business needs to know where its money will come from. The cash flow should not be dependent on where one is, in the funding cycle.
  2. Rounded team – Build a great team if you want to build a great product. A strong team stands by you to make it possible.”

What would you say to the entrepreneurs starting up fresh out of college? 

SR: “There is no right time to startup. Whenever you get passionate about a problem and see a large market for it, go for it. Here are my 3 tips:

  1. Address a big problem. If you go after a problem which is not so big, it may not be worth all the effort. India provides huge opportunities with really major problems that need to be addressed.
  2. Maintain discipline. Whatever you do, think big and build for the long term.
  3. Understand your responsibility. As you grow your team, you need to realise that families of your employees are getting dependent on you. It is essential that you take your decisions wisely.”

What are the mistakes you wish you did not make?

GH: “We were too slow in the start. We should have been aggressive, and believed in ourselves more. We thought people might not accept a technological solution. We have realized however, that technology has to lead the change in society. Invest in constantly being disruptive and you will definitely make a difference.”

News piece sourced from ProductNation. Read the full piece here.

Oct 24, 2018

Card image cap
Working Capital Financing: Why It Is Essential For The Success Of a Business

India is on the path of robust economic growth. According to official figures, the economy was valued at $2.2 trillion in 2016, making it the world’s seventh largest economy in terms of nominal GDP. The Indian economy is expected to reach the $5 trillion mark by 2025, according to a report published by Morgan Stanley in February 2017. India seems to have all the right ingredients in place to achieve this phenomenal growth; the country’s millennial population is massive, there’s availability of cheap labor, the government’s policies are favorable, Indians have exhibited high adoption of the latest technological advancements and the SME segment is growing at a fairly healthy rate.

The SME (Small and Medium Enterprises) sector is critical to the development of the Indian economy. It contributed 40% of the nation’s exports and 45% of total manufacturing output in 2015. The segment’s contribution to India’s GDP is expected to grow from 17% recorded in 2010-2011 to 22% by 2020.

Despite these facts, the SME sector has witnessed some challenges with regards to financing. The need for cash to manage daily operations and the inability to access commercial finance have hindered the development of SMEs.

Why is Working Capital So Critical for Any Business?

All businesses need some funds to run their daily, weekly and monthly operations. Working capital is, therefore, essential for the smooth working of a business. The main reasons for working capital being so important are:

Enhances Solvency: Working capital aids a business to operate smoothly and meet all its short-term expenses, including purchasing raw materials, payment of salaries and meeting overhead expenses. Some of these payments cannot be delayed. Having sufficient liquidity helps the uninterrupted flow of production; thus, maintaining the solvency of a business.

Increased Goodwill: When a business is able to promptly meet its regular expenses and pay salaries on time, it generates goodwill, not just internally with employees but also with suppliers and distributors.

Uninterrupted Supply of Raw Materials: Quick payments ensure regular supply of raw materials. Suppliers of raw materials are usually apprehensive about small businesses being able to make the payments and do not offer a suitable credit period. The inability to pay suppliers can result in production coming to a standstill.

Improved Ability to Face Any Crisis: Apart from the smooth functioning of business operations, working capital ensures that any financial emergency can be handled with ease. Sometimes businesses face an unforeseen event, like an order being rejected, unfavorable weather conditions or the unavailability of a particular resource. A business that has sufficient liquidity can cushion itself against such situations. Thus, the financing of working capital defines the financial health of a business and how smoothly it can operate under different circumstances.

Why is Working Capital Finance So Difficult to Get for SMEs?

The most critical challenge that even profitable SMEs face is the lack of working capital, given their inability to access commercial finance. Public sector banks are burdened by bad debt loans to offer any support to these companies. Traditional banking institutions are apprehensive about offering commercial finance to SMEs and place stringent eligibility criteria for approval. Most of their loans require collateral to be furnished even for financing of working capital.

The greatest problem is that the loan application and approval process of traditional banking institutions is so tedious and prolonged, that SMEs find it excruciatingly painful to access these options. They may have to wait months only to have their loan application rejected. SMEs, therefore, look for alternate sources for financing of working capital and turn towards unorganized moneylenders who charge exorbitant interest rates.

Working Capital Financing Needs Met By Technology

SMEs need financing of working capital. They need swift and easy availability of commercial finance, without the need for extensive paperwork and collateral. The solution finally arrived in the form of FinTech lenders like Capital Float.

The FinTech segment has revolutionized the financing of working capital for SMEs by using cutting-edge technology in the loan application, underwriting and approval processes. This enables the disbursement of funds to SMEs within a matter of days.

Types of Working Capital Financing

There are a number of flexible, short-term and collateral-free loans offered that can be used to service new orders, purchase inventory and maintain cash cycles. These include:

Term Finance: This is ideal for SMEs particularly in the manufacturing and distribution space that need funds to meet operational needs or to expand and diversify the business.

Online Seller Finance: This is best suited for businesses that sell their products on leading online marketplaces. Capital Float has partnered with India’s largest marketplaces, like Amazon, PayTM, Snapdeal, Myntra, Shopclues and eBay to offer eCommerce sellers customized working capital finance.

Pay Later Finance: This product offers a credit facility and suits SMEs that have to regularly replenish their inventory. This revolving credit facility enables a borrower to make timely supplier payments from a predetermined credit amount. This amount can be reset upon repayment and is made available for further use.

Merchant Cash Advance: This credit solution is for businesses that receive payments via credit / debit cards via PoS (point of sale) machines. Capital Float has partnerships with multiple PoS machine vendors such as Pine Labs, Mswipe, ICICI Merchant Services, MRL Posnet and Bijlipay, expanding its reach to merchants across the country.

Supply Chain Finance: This commercial finance product allows businesses to use their invoices or accounts receivables as the basis to gain access to liquid funds.

SMEs are of strategic importance to the Indian economy and deserve a business climate in which they can thrive and grow. The financing of working capital made available by FinTech lenders will help the SME segment to move forward and contribute significantly to the growth of the Indian economy.

Oct 24, 2018