Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I bet the junior is better than him....I bet MOST juniors are better than him. Now he can move on to another place where they’ll miraculously keep him around with a big salary, not knowing that he sucks and is shit for brains until he destroys their system like he destroyed yours with his shit code
-
Maer17823yInform management, roll back his last commits, implement required functionality again, cleanly.
If management is against this idea, explain how everyone will otherwise spend X amount of time per week from now on fixing issues resulting from this poor architecture. -
Oh another lead/senior developer that doesn’t know how to test and couldn’t care less about quality … Peter Law never fails.
-
irene33943y@Maer I would roll it back but I have no idea why it works enough to reproduce the functionality. Also I don’t have time allocated to do that right now.
I also do know that it previously worked against an API for an external system that is now gone. 🙄 -
irene33943y@Maer That has been my overall impression of this product. The two lead devs I have worked with had a “push the chariot” mentality. That turns relatively simple functionality into very ugly code. I have communicated that to management before. I got “Not all tech debt is bad. Sometimes debt is how we pay for something that we can’t afford immediately.”
I agree with the sentiment but there have been a lot of of hot wet shit piles added to the code when we could have taken a few hours longer and engineered it properly. Until recently I was the only one on the team that uses an engineering approach. -
killames5733yAmusingly good unit test tend to test everything in the order of dependency so yeah they can get extensive
-
irene33943y@killames It tests an express router. There are five routes that point to four different controllers. Each route has auth middleware. The controller responses don’t matter in the test because that should be tested in the controller tests. The middleware rejections are important to test because they check the permissions on the routes. The liveliness of the routes and their params is also important.
What we ended up with is a router test that tests both the routes and controller responses. The controller responses depend on responses from the service layer. So the tests mock the service layer for the controllers that are in the test. They also mock a bunch of things in the controller. I made some changes in the service layer to add redis caching and the tests in the router choked because we aren’t mocking the redis connection so it attempted an actual connection to redis.
There is no defence for bullshit wide net coupled tests. Test the code you wrote. -
killames5733y@irene but arguably there is because it tests that something hasn’t been accidentally altered and can aid in changes you’re making or test code you’re busy writing
Can also tell you later in a sprawling million line app if everything is working to help you figure out what’s not -
irene33943y@killames Imagine if you were in school and writing a test for chemistry. The test is twice as long and the second half is about philosophy.
Angrily you go to the teacher and say, “This seems unfair that you would be testing philosophy on a chemistry test. They have nothing to do with each other.”
The teacher responds, “We heard that you were in philosophy class. That is also an important subject to know. So we are testing that on your chemistry test as well.”
You are arguing that the teacher has a valid point. -
irene33943y@killames Also I’ll point out what I wrote in the post. No tests actually failed in this situation. So how can this help find broken code?
-
killames5733y@irene it fails once logic errors have been ruled out lol that or the test wasn’t written right or failed to pick up. A scenario
-
killames5733y@irene that scenario doesn’t compute
Look in a perfect world a programmer takes an extra couple minutes to write something that tests his smaller code components like methods and classes -
irene33943y@killames It gets into a state where the test scripts simply don’t conclude. All tests pass. The test script never completes and there are no errors. That is why this is a rant. Scoping tests is important. Don’t couple the shit out of the system.
Basic engineering is basic. -
killames5733y@irene ohhh you mean he didn’t account for them in a time estimate ? Not my definition of coupling which usually means pair lol and I really don’t see how though. If the condition is correct only the uses of the items tested should be failing but there should be some small test for that too perhaps ?
-
killames5733yLike let me put it this way
Let’s take the case of autogenned code which you autogen the unit tests for for say a dal layer
If any of the tests fail and manual inspection of the unit test code says it should work you know a table or store prof is missing
Image reading
You identify sections in an image comp v with a created image
Image pixels don’t check out you have a problem
Service testing
You start only the services in a pipeline pointing at a test environment you place a file or a record in a database somewhere you look at the way it’s changed
The last is where there could be some logic errors because maybe it creates. A record it shouldn’t -
killames5733yAnd always remember if time is built in its job security lol more time
To do everything -
killames5733y@irene I understand however I only ever got to write unit tests at one job and the problem is there’s were somehow running for several hours so they just commented them all out and never ran them prior to deploy
-
irene33943yWe have unit testing in our pipeline that happens when code gets promoted. We have functional tests in the repo that run with a PR or merge.
This is a functional test. Like seriously stop being such a testing fanboy and read the context here. -
Maer17823yA "unit test" is intended to test a "unit". It is not intended to test dependency chains. "I need to test the app logic whole" is a non-argument, this is not what these tests are for.
I understand the intent to make sure the whole application works, and thus test whole chains of functionality, but even theory aside, I have seen such approaches in action and they blow up the larger the project gets. Unmaintainable, fragile and when it breaks you begin searching, because your test broke *somewhere* in a dependency chain.
This is also why unit tests tend to work with mock classes and frameworks such as Mockito. Your tests needn't to test objects plus dependencies, but only minimal units of functionality. You need to be certain what goes in and comes out is exactly what you want.
Whole modules are tested via end-to-end testing, integration testing, functional testing and so on. -
irene33943y@gcavalcante8808 Did you think about Plato’s allegory of the chariot? Or the song Roll The Old Chariot Along?
Related Rants
The lead dev left the company two weeks ago. His last hurrah involved committing a bunch of complicated code into our API. The code he writes is generally overly coupled but this particular code is INSANE.
It is so coupled that the tests for it almost mock the entire application end to end. I only found this heap of garbage when the deployment tests were hung after I made a simple change in a totally unrelated file. THEY DIDNT FAIL. JEST GOT INTO A STATE WHERE IT CANT CONCLUDE AND HAS NO ERROR MESSAGES. We are taking about entirely different parts of the code. As far apart in the code as it can get. It took six hours of playing Sherlock Holmes to figure out what was breaking.
He got the most junior developer to approve the garbage PR as well.
rant