Deeply nested If-Else statements are the problem, not If-Else per se

Deeply nested If-Else statements are the problem, not If-Else per se

If you are a sophisticated programmer, then you never use If-Else statements, else you’re a hack. At least that’s what I’ve been reading. Maybe those articles do have a point and maybe I would not have read them if their wording was not so extreme.

If you are a sophisticated programmer, then you never use If-Else statements, else you’re a hack. At least that’s what I’ve been reading. Maybe those articles do have a point and maybe I would not have read them if their wording was not so extreme.

Inevitably, responses to those articles point out that anything worth doing on a computer involves making decisions. Indeed anything a computer does involves making decisions.

For example, let’s say that you go to a Local Global Bank ATM, put your ATM card in. If you are a Local Global Bank customer, you can proceed to PIN entry, else the ATM asks if you agree to a $5 service fee. If you agree, you proceed to PIN entry, else the ATM releases your card and you go on your merry way.

If you enter the correct PIN, you can proceed to transaction selection, else you’re given one or two more tries to enter the correct PIN. If you make too many incorrect attempts, the ATM “captures” your card.

By the way, that thing about using reverse PIN to alert the police to a thief is a complete myth; I’ve never heard a bank employee advise customers to not choose palindromes for their PINs. So that’s one less conditional branch for the ATM software to take into account.

Let’s say you’ve entered the correct PIN and selected to withdraw $80 from your savings account. If your savings account balance is $80 or more ($85 if the service fee applies), then the ATM dispenses $80, else the transaction is rejected for insufficient funds.

software-development cyclomatic-complexity java if-else

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Offshore Software Development - Best Practices

To make the most out of the benefits of offshore software development, you should understand the crucial factors that affect offshore development.

5 Core Criteria for Selecting Software Development Company - TopDevelopers.co

Check out these five criteria for the selection of your software vendor, and you will never regret having the wrong quality product made for you.

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).

Wrestling Betting Software Development | WWE Betting Software Developers

Wrestling betting software development solutions from expert Wrestling betting app and software development company delivers ultimate betting experience. Chat with us.

Developer Career Path: To Become a Team Lead or Stay a Developer?

For a developer, becoming a team leader can be a trap or open up opportunities for creating software. Two years ago, when I was a developer, ... by Oleg Sklyarov, Fullstack Developer at Skyeng company