Software debugging Part 3: First principle approach (2024)

This is one technique I use for cases where the code was working fine up to a point. I use this also for code writing, when I use libraries where documentation is minimum. The first principle as in wikipedia is — “ A first principle is a basic, foundational, self-evident proposition or assumption that cannot be deduced from any other proposition or assumption.”. In my words — “A first principle is that point in which you are sure that everything is correct”.

Whenever I make a mistake and is not able to find out why the code broke, I start from the point in which the code was working well and fine. I walk along the modifications from the start to point where everything went wrong. Versioning systems always help me in this. I always commit my code for the smallest changes. Now when something comes up which was not there before I move my commit back and start from that point. I keep track of the stable commit but I can always checkout previous working code and see where the error started.

Sometimes I take out sub-molecular sentences and try to identify what went wrong. Usually atomic sentences are correct if not we have to start with that. So, for an error in a big code I make a small working code from samples similar to the sub-molecular sentence which is causing the problem. If the sample is working I will build from that and replace the original problematic code with the new one.

Extra points: I sometimes mix mathematical inductions into debugging. Instead of working with the whole set of data for which your code is being tested, test it on one data and then a small batch and see whether they are working fine. If something is wrong, it is faster to debug and fix with this instance. If it is correct then according to induction the code would work on similar set of data. The time and effort it takes to make a batch based code and using it will be very small compared to debugging the code with the whole dataset without any change in code. And as a good standard the code should always work with different dataset size, so mostly no change is needed in the code.

I use first principle also when coding. This is not purely a debugging information. But I will just go through it. Sometimes the library we use doesn’t have the documentation needed. In this case I use the First Principle extensively to write my code. My first principle in this case starts from the fact that the compiler is never wrong. If the syntax and semantics is correct it should work. Most get the syntax correct without any problem and they forget about the semantics. A simple example would be for an assignment the assignment variable and value should be of same type(keeping aside casting operations). Sometimes people try to identify what went wrong with a compilation in which the code is syntactically correct. This usually happen in cases where a new library is used and they trying to do a brute force approach to figuring out the library. Although the concept may be known they try to use every object which fits the description. Instead we can verify what the input and output of function is, and type of assignment variable used before starting the first line of code. We can use that information to cut down the objects to use in that circ*mstance and build on that. Its like making a structure from building block. If we know those pieces of blocks which fits exactly to other and we know the structure of the building, then it is easy to build it.

I have lot more to say about the topic. But may be I will do that sometimes later. Hope this was useful and expect some comments on the whole set.

My older article in the set Part 1, Part 2

Software debugging Part 3: First principle approach (2024)
Top Articles
ABLE Accounts and SNTs: How to Choose? | Special Needs Alliance
About | Security Directorate - Pakistan Civil Aviation Authority
Pollen Count Centreville Va
Craigslist St. Paul
Team 1 Elite Club Invite
Sunday World Northern Ireland
Jesus Revolution Showtimes Near Chisholm Trail 8
Jcpenney At Home Associate Kiosk
Culos Grandes Ricos
10 Great Things You Might Know Troy McClure From | Topless Robot
Items/Tm/Hm cheats for Pokemon FireRed on GBA
C Spire Express Pay
Diablo 3 Metascore
Calmspirits Clapper
Jesus Calling Oct 27
Justified Official Series Trailer
Dallas Cowboys On Sirius Xm Radio
Obsidian Guard's Cutlass
Jellyfin Ps5
Energy Healing Conference Utah
Recap: Noah Syndergaard earns his first L.A. win as Dodgers sweep Cardinals
Evil Dead Rise - Everything You Need To Know
Hobby Stores Near Me Now
eHerkenning (eID) | KPN Zakelijk
Craigslist Personals Jonesboro
Walmart Near South Lake Tahoe Ca
Yugen Manga Jinx Cap 19
Panola County Busted Newspaper
Medline Industries, LP hiring Warehouse Operator - Salt Lake City in Salt Lake City, UT | LinkedIn
Ocala Craigslist Com
Paradise Point Animal Hospital With Veterinarians On-The-Go
R/Mp5
Ff14 Sage Stat Priority
3 Bedroom 1 Bath House For Sale
Kokomo Mugshots Busted
Bozjan Platinum Coins
Luciipurrrr_
Marine Forecast Sandy Hook To Manasquan Inlet
Drabcoplex Fishing Lure
Sadie Sink Doesn't Want You to Define Her Style, Thank You Very Much
Games R Us Dallas
Honda Ruckus Fuse Box Diagram
Gun Mayhem Watchdocumentaries
18 terrible things that happened on Friday the 13th
Aurora Il Back Pages
Europa Universalis 4: Army Composition Guide
Diamond Desires Nyc
Epower Raley's
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 5788

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.