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
Bharat QR vs POS Machine: Which One Is Better?

FinTech is disrupting the very fundamentals of money management the world over, and India is no exception. With the Prime Minister’s focus, especially, on making India “digital”, a number of programs and schemes have been launched. In fact, many of the schemes have taken a cue from the private sector and have upped the innovation game to deliver a comfortable and convenient money management experience. From the point of sale (POS) machines to merchant cash advance to e-wallets, we are seeing a plethora of FinTech products and services change the way we pay. And this phenomenon is occurring across industries, whether it is the fast moving e-commerce sector or the heavy-duty manufacturing sector.

Consumers are at the receiving end of these changes and need to fast adapt to the new payment means. First it was a revolution of the plastic money, with cash bring replaced by credit and debit cards. This demanded the use of other paraphernalia, such as the point of sale devices at the checkout counters. Now, with niche FinTech innovators such as Paytm and MobiKwik, even the point of sale devices are not required. It is just scan and pay. The government has taken this ease of payment a step further by bringing to light the Bharat QR payment method.

What is Bharat QR 

Bharat QR is a payment process driven by a Quick Response Code or QR code. A user who has the Bharat QR-enabled bank application on his or her mobile phone can make a payment quickly, easily and safely. The best part is that scanning the machine-readable optical grid translates the bank account information without your having to swipe or hand over a card, making it extremely convenient! This is because the QR grid stores the person’s bank information. This is similar to using a Paytm or a FreeCharge or a MobiKwik e-wallet, the advantage being that in Bharat QR, payments are linked directly to your bank account rather than to a separate e-wallet. There is thus no hassle of transferring money to your Paytm wallet or MobiKwik wallet. Alternatively, the user can also access Bharat QR through the Bharat Interface for Money or BHIM universal app, which is a UPI developed by the National Payments Corporation of India (NCPI).

Currently, Bharat QR is available on the mobile applications of 15 nationalised and private banks, namely – Axis Bank, Bank of Baroda, Bank of India, Citi Union Bank, DCB Bank, Karur Vysya Bank, HDFC Bank, ICICI Bank, IDBI Bank, Punjab National Bank, RBL Bank, State Bank of India, Union Bank of India, Vijaya Bank and Yes Bank. It is also linked to VISA, MasterCard, American Express and RuPay cards. Its scale is expected to increase in the coming days.

A look at Point of Sale

Bharat QR is thus a leap ahead of the Point of Sale payment mechanisms, which were the mainstream payment devices used at most commercial and consumer locations such as shops and restaurants. The Point of Sale or POS terminal is a computerised replacement for a cash register that can process credit and debit cards. A customer swipes their card in the machine and enters the PIN number to verify and complete the transaction. The POS is installed at the merchant location, mostly by the bank that they associated with. Not only does the merchant bear the cost of the device and the installation, but they are also compelled to pay the issuer bank a merchant discount rate (MDR). This is a percentage of the transaction value. In a bid to boost cash transactions, the RBI had rationalised the Merchant Discount Rate (MDR) for debit cards. Accordingly, a cap has been introduced for debit card point of sale payments, capped at 0.75% for transaction values up to Rs 2000 and at 1% for transaction values above Rs 2000. However, it continues to be an expense for the merchant, and is often passed on to the customer by increasing the selling price of the product or service. Often, buyers may not even realise that they are being charged extra for the MDR.

Other payment instruments: e-wallets

The first leg of replacing the point of sale was the onslaught of e-wallets such as Paytm and FreeCharge. Although they operate on the same principle as that of scanning a QR code, they are somewhat restrictive because they require both the transferor and the receiver to have the same e-wallet installed on their smartphones. The need was thus felt for a faster and easier money transfer mode, which caused the Bharat QR to come to the fore, thanks to the design and development by NCPI.

Advantages of Bharat QR

The Bharat QR is a step towards financial freedom by means of cashless transactions. It relieves one from the hassle of swiping at the point of sale or of facing detection troubles with one’s plastic money at the point of sale. Because there is no requirement of a physical use of a card, the risk of data theft or security issues through tampered or cyber-compromised point of sale devices is also minimised. Costs are reduced from both the consumer and merchant viewpoints, since the need for expensive point of sale devices and their MDR charges is eliminated. A significant advantage of Bharat QR is its ease of operation; i.e., the buyer and seller need not download the same payment application to make the payment happen, unlike Paytm. This is because the Bharat QR is directly linked to a single bank account. It poses a logistical relief, since businessmen now need not shuffle between different wallets and track their credits and debits – a tedious task. Moreover, the money transfer happens instantly because Bharat QR uses an IMPS service. Bharat QR truly has the potential to create a FinTech revolution.

It is clear that Bharat QR paves a convenient way ahead for paying and receiving funds. It is a great idea to get started on this universal tool. As a merchant, you must register with your banks to get authorised to receive payments through Bharat QR. Link your bank account to the BHIM app and generate your unique Bharat QR Code, take a print of your QR code and stick it onto your payment counter to get started.

Oct 24, 2018

Card image cap
Convenient Supply Chain Financing Creates Resiliency In The System

Supply chain finance is an important but often underrated aspect of supply chain management. At its core, supply chain management is the management of the flow of material / services, data and money through a network of assets from the point of origin to the point of final consumption (and back). Natural disasters, geo-political crisis and financial crisis faced by the world over the past decade have forced companies to move away from only optimizing their supply chains to making them more resilient. For a supply chain to be truly resilient, all risks associated with the asset base managing the flow (i.e. the material & services, data and money) must be negotiated intelligently, keeping in mind that each one represents a point of failure or a point of opportunity.

Industries are habituated to ignore the significance of supply chain financing. While there has been a lot of collaboration between different constituents of supply chains, they usually center on inventory. However inventory and finance are intrinsically linked; increased players in the supply chain machinery is directly proportionate to the increased complexity in the financing of the process. This is especially true in a country like India, where the number of intermediaries, in many cases outnumbering the actual value addition points, poses a complex problem from the paradigm of supply chain finance and more importantly supply chain resiliency.

As with anything in a complex supply chain, the bulk of the power resides in a few constituents (maybe the retailer or the manufacturer depending upon the specifics of the value chain). These companies understandably look out for their own interests especially when it comes to supply chain finance. Though concepts like JIT (just in time) inventory and quick turnaround times from order-to-delivery have reduced inventory levels held drastically, most companies still hold onto the traditional 30-45-60 day of credit terms with their suppliers. This puts incredible financial stress on the supplier which in the worst case manifests in poor quality of supply. In the long run, this increases the total cost of ownership for the company, i.e. investment in more stringent QC processes, returns, disruption to the manufacturing process, supplier switching costs etc. Applying the same principles of collaborative thinking to supply chain finance will not only make the overall chain more resilient but also optimize the flows and pass on efficiencies in the long run to the end consumer.

In today’s business environment where “share holder value” is no longer a buzz word but the focus of every corporate board of directors, it might be wishful thinking to expect companies to share their margins or reduce days of credit to suppliers in the interest of collaboration. This is where a third party financial institution plays an important role. By providing liquidity to the supplier on the basis of the credit umbrella provided by the bigger company, the addition of the third party financial institution creates a win-win across all stakeholders involved. This is even more critical in the case of small and medium sized enterprises, which at this point are forced to spend only a fraction of their efforts on innovation and growth.

While some large corporates do have some form of supplier financing initiatives through tie ups with Banks and NBFCs, in most cases the coverage of the initiatives are limited (to some marquee suppliers) and in a larger amount of cases are a generic form of receivable financing based on existing credit policies of the financial institutions, which are out of sync with business realities. It is imperative for large corporates to have a supplier financing initiative for all their suppliers, especially the SMEs to manage their financial risks. In turn it is imperative for the financial institution to have a tailored product which reflects the operating realities of the industry and also the specificity of the supply chain. Collaboration of all three stakeholders, i.e. the large corporate, SME supplier and financial institution will be critical to ensuring a sustainable supply chain finance program.

We live in an interconnected world; therefore large corporates have the responsibility to ensure that their SME suppliers have access to finance, if they truly want to make their supply chains resilient.

Prashant Adhurty

Prashant has 11 years of experience in business strategy and operations, with specific expertise in the areas of project management, supply chain management and business process formulation , across the retail sector, United Nations system & international organizations, telecommunications & high technology, oil & gas and 3rd party logistics. He has successfully managed and delivered projects for clients based out of Europe, the USA, Africa and India.
At Capital Float, Prashant heads Business Development for Supply Chain Financing.

Oct 24, 2018

Card image cap
What Makes Unsecured Business Loans Safe for Your Small Business?

Unsecured small business loans are considered as one of the safest ways to raise short-term finance for meeting the working capital requirements or urgent funding needs of a business. The safety feature is attributable to the fact that these unsecured small business loans do not require any collateral or security in the form of assets of a business. Most small businesses do not have adequate assets to offer as collateral. The elimination of the need for collateral makes it possible for such businesses to raise loans.

Recent years have witnessed the launch of new-age lenders and the introduction of products that have revolutionized unsecured business loans in India. This is not merely via the easy access to funds, but also offering customized solutions for different businesses and tying the repayments to the accounts receivables or inflows from credit card sales of a business.

Ensure uninterrupted business operations

Often small and medium enterprises (SMEs) need funds for their daily operations to ensure the smooth functioning of their business. Funds may be required to purchase raw materials, pay wages and salaries, clear utility bills and meet unexpected expenses. SMEs may also need immediate funds to grab a business opportunity or take advantage of a seasonal upswing in the demand for their products. These funds are required before a business services its customers and raises invoices. The lack of availability of funds at this time can threaten the very survival of a business and, at the least, could throttle any growth opportunities.

This is when unsecured small business loans come to the rescue. SMEs are able to sustain their businesses with the help of such funding options.

The main reason behind the increasing popularity of unsecured small business loans in India is their easy availability. Only a few years back, businesses had no other option but to approach banks and other traditional financial institutions to raise funds. Even if a business could satisfy the stringent eligibility criteria for loans, it could take months before the funds were disbursed.

With the emergence of FinTech lenders, it has become possible to secure funds in a matter of days. Such lenders use the latest technology to assist the loan approval process, making the sanctioning and disbursal of loans swift and easy. Such loans are safe because they are easily available and ideal for preventing any disruption to operations.

Protect Your Bottom-Line

Most SMEs are unable to meet the eligibility criteria put forth by traditional financial institutions. In fact, it was impractical to approach banks for urgent liquidity needs, given their long-drawn approval processes. Thus, most businesses were left to the mercy of unorganized money lenders who would charge steep interest rates.

FinTech lenders now offer loans that are easy to access, with faster approval processes and more affordable interest rates. With these solutions in place, businesses can protect their bottom-line by raising unsecured business loans without paying exorbitant rates of interest charged by unorganized moneylenders.

Flexible Repayment Options

Unsecured business loans come with flexible repayment options. The term of the loan could range from six months to three years. The repayments can be on a daily, weekly, fortnightly or monthly basis. Some products like Capital Float’s Online Seller Finance and Merchant Cash Advances link repayment to the operating cycle or receivables and credit card sales of the business. This flexibility puts a business in a better position to make repayments. Since the repayment is a specific percentage of the monthly sales, there is no added pressure on the borrower to repay the loan. This also ensures that the borrower is not stressed about repayments when business is slow.

No Restriction on Use of Funds

When a business takes an unsecured short-term loan, the lender does not impose any restriction on how the business deploys these funds, unlike in the case of secured loans. The borrower can use the loan amount to fund daily operations, purchase raw materials, pay utility bills or market its business.

Flexible Loan Size

In the case of a secured loan, the amount that a business can borrow is determined by the value of the collateral. In the case of unsecured business loans, the amount can be determined by the need for funds. With Capital Float’s Merchant Cash Advances, a business can borrow any amount ranging between ₹1 lakh and ₹1 crore. Although the amount is correlated to the credit/debit card payments to a business, the loan can be as high as 200% of the monthly card settlement.

Related: How to Get Collateral Free SME Loans for Your Business in India

Defaulting on Repayment of Unsecured Small Business Loans

Unlike in the case of secured loans, a lender cannot seize any assets of the business in case of a nonpayment of the loan amount. However, defaulting on a loan can have serious consequences. A business may not be able to take another loan once it has defaulted in repaying one. The failure to meet repayment obligations could end in a lawsuit.

Prior to taking such serious measures; however, lenders would offer options to make it easier for a business to repay the loan. If a business is unable to repay a loan as per the scheduled timeline, the best thing to do is to contact the lender to explain the reasons for default and to set a revised repayment plan.

In fact, most experts advise SMEs to build a long-term relationship with the lender. Unsecured loans can be taken on a recurring basis, making money available exactly when a business needs it and planning repayments when the business is expecting an inflow of funds from customers.

Oct 24, 2018