News for hackers. Stuff that matters.
Re:Unit Testing Is Overrated by qmmmur on Thursday July 09, 2020 @08:48AM (#23779594)
What if you write code that isn't for a business? How does your workflow apply then?
Re:Unit Testing Is Overrated by jugg1es on Thursday July 09, 2020 @08:56AM (#23779665)
business logic does not mean it has to be for a business. It's more like calling the pointy part of a spear the "business end". It's the part that does the job.
Re:Unit Testing Is Overrated by hoorayimhelping on Thursday July 09, 2020 @08:57AM (#23779669)
Business Logic is a euphemism. It doesn't mean literally business logic, it means the 'core functionality of your code.' When you design software, you typically model some real world process or system in the abstract. Business logic is the core problem of your model. You can also call it model code, or core functionality. It all means the same thing - it's the important part of your app.

Using the old Asteroids arcade game [1] as an example: The business logic is how many lives the player has, what happens when you shoot asteroids (they break up, or disintegrate if they're small), what happens when you reach the edge of the map (you wrap around the other side), what kind of control scheme there is (there's momentum in asteroids, you don't stop on a dime) etc.

1) https://www.youtube.com/watch?v=WYSupJ5r2zo

Re:Unit Testing Is Overrated by SamuelAdams on Thursday July 09, 2020 @09:54AM (#23780219)
"domain logic" might be a better euphemism. Consider a library that encrypts text with AES-256. You might want unit tests that verify the IV, cypher block, plaintext and encrytped text (result) of that function. The method, "encrypt" might be your "business logic" that ought to be unit tested.
Re:Unit Testing Is Overrated by gnulinux on Thursday July 09, 2020 @02:32PM (#23783440)
"Business logic" is just another name of "logic". E.g. something like "if X is even, then print 'fizz' otherwise print 'fuzz'" is considered business logic.