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
How to add "Contact" button to Instagram ? - Efforts Solutions IT
Contentos (COS) Price Prediction 2024, 2025–2030 | CoinCodex
Fhlweb Account Funded Meaning
Craigslist Cincinati
Ky Cna Validation
Caroline Cps.powerschool.com
477 Job Calls
123Movies Kingsman Secret Service
Stellaris Piracy Suppression
P.o. Box 3002 Phoenixville Pa 19460
Meshuggah Bleed Tab
Reading Craigslist Pa
Planet Fitness $99 2023
Cac Card Reader Staples
Rauw Alejandro New Song 2022
Best Food Near Detroit Airport
Acme Realistic Tattoo Speakeasy
Tmj4 Weather Milwaukee
Lucki White House Lyrics
Pokemon Radical Red Move Tutor
Thankathon
N3: Ninety-Nine Nights Review - IGN
18002226885
Safety Jackpot Login
Avidxchange Cashflow Manager Login
Worldfree4U Movies In
Grace Kinstler Bathing Suit
Part City Near Me
O'reilly's In Mathis Texas
Kilroy Realty (KRC) Earnings Date and Reports 2024
Dr Thottam Ent Clinton Township
Brazos County Mugshots Busted Newspaper
3Si Tracker Login
craigslist sitemap for Ludington ± 9 mi
Samantha Lyne Wikipedia
Steve Jobs' 4 Kids: All About Reed, Lisa, Erin and Eve
Conan Exiles: Cheats und Kommandos für das Game
Sam's Club Gas Price Mechanicsburg Pa
Edison Park, Bratislava
CUE 2016 National Conference Schedule
Thankathon
7 On 7 Flag Football Misdirection Plays
Craigslist Oneonta New York
Craigslist Gigs Galveston
What Website Assists The Educational Services Officer
Loopnet Properties For Sale
Trap Candy Strain Leafly
Hashtag Basketball Defense Vs Position
Purplefoxy840127
*!Thangalaan (2024) 𝙵ull𝙼ovie Downl𝚘ad Fr𝚎e 1080𝚙, 720𝚙, 480𝚙 H𝙳 HI𝙽DI Dub𝚋ed Fil𝙼yz𝚒lla Isaidub
Da Costaschool Elspeet viert 25-jarig jubileum!
Gym Cerca De Mí
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.