11

Today I finally experienced the power of something I learned in university: propositional and predicate logic.

Many developers I know think that such education is useless. Well, today I have proven that it is very useful. On a day to day basis, working on banking software, complexity in purely logic is very low. However, we have a screen that must show or hide elements based on some input values and conditions associated with certain elements. How hard can that be, right? Well, there are many variables to take into account and as such it's absolutely not trivial.

This screen didn't work properly and maintaining the code is hard as there is a lot of logic to show/hide, enable/disable things and so on. After quite some time and attempts by fellow developers, I decided to refactor the whole thing. I'm responsible for the quality of the software and it was quite degrading, so I had to do something.

In order to get things working properly, I defined collections of constants (ui elements) and predicates. Then, I defined for which element what predicates must be true, in order to hide/show, disable/enable etc. I then translated these predicates into code. And guess what? It works! Of course it works. It's logic. But I'm very pleased I finally could actually use some of all the math I studied!

Comments
  • 5
    Formal logic is extremely useful, yes. More devs should study and use it instead of disregarding it as "that theoretical bullshit".
  • 3
    That's likely how I would organize and build it, too. Very clean and straightforward to read and maintain.

    Never took that class or anything like it. (I dropped out of college because it was bloody expensive and pointless)
  • 1
    @Root if you're interested/have the time Coursera has a course on Introduction to Logic by Stanford

    Starts off a bit basic but they have this cool proof game kind of thing which allows you to mess around with logic systems (also provide interesting challenges).
  • 2
    @RememberMe That sounds interesting!

    I've enjoyed almost all of the one-off classes I've taken from udemy, coursera, mitx, etc.
  • 1
    Beautiful story!!!! I wish I read more of this rather than "why get a computer science degree when you can always go to a bootcamp" type of stuff. People don't understand that what we use in practice is the product of previous practice and good theory. Having the good theory saves a lot of time and energy, and also provides insight into problems that would have been otherwise impossible. Thank you for sharing, sir or ma'am
Your Job Suck?
Get a Better Job
Add Comment