Robert Cecil Martin (uncle Bob) demonstrates test driven development by implementing a stack in Java

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

"Make the tests increasingly specific, the production code increasingly general."

falke
Автор

In "TDD by Example" Kent Beck explains that in the Refactor step of the red/green/rafactor cycle you "remove duplication"! Now Uncle Bob returns 99 in pop() at 21:52. Instead of going on with a new cycle ("augmented test" he calls it, red, i.e. a new cycle) he should instead first remove the duplication of the 99! According to Beck we have to ask ourselves: Where does the 99 come from? From the push(99)! So you have to somehow save it, in order to retrieve it again in the subsequent pop(). If you explain it that way, you can understand that the brain cells that you supposedly aren't using, you are using in the refactor step! Kent says: Make the failing test as quickly green as possible, but don't forget to refactor (remove duplication) afterwards!

falke
Автор

Only 3 concepts: Parameters, Subject and Informational Individual! This is the future in software!

gmxmatei
Автор

This exercise looks a lot how AI tries to write code for me 😂

whymydiy
Автор

Programming is making ape noises and saying "im a programmer" every 10 min

danielvelkov
Автор

This way of TDD is pretty bad. You can end up with a class that doesn't do anything as you are not forced to think about the implementation, but only the test and "make the test work". And you postpone any real work to a later stage, often require heavy refactoring. Having a rule of something like "you must act on internal representation" will make you sooner to have to create local fields.
A typical developer wil test a single push, but most will not test a consequtive one. So missing some of the functionality. Even Bob is missing that usage can result in adding an element outside the array size.

SPeeSimon
Автор

This methodology seems so unfun and draining 🤔

mattetis
Автор

This is all fine and dandy for this ridiculously trivial use case. When one has to build something that is orders of magnitude more complex creating tests like this is going to slow the development down significantly.

MrMikomi
Автор

Uncle or unclear? Programming isn't the same as coding. Before you think about clean code, think about clean programming. And that means, use mathematics.

rafageist
Автор

Rewarding at work. Spend 3 to 4 times the amount of time to produce the same thing. Produce 2 to 3 times the code that has to be maintained. Your companies cost increased and the amount of time to produce the same product increases. Yet, the cost of running the business and hourly wages, electricity, property cost and so on all stay the same. Sure do this if you like the unemployment line being in your future or your company going bankrupt.

GRHmedia
Автор

Stack, Stack and Stack .... but the future in software is Universal Software Model! Much more simple.

gmxmatei
Автор

30 minutes to implement a stack with a gigantic memoryleak.

Dude sucks.

fssig
Автор

This way of testing is useless. Very strange that a famous developer is missing the point so far.

fordprefect
Автор

I hate TDD if anyone who I hire ever suggest it it will be their last day at work for me. It serves no good purpose in my opinion. You create code to test other code but you don't create code to test the code that is testing the other code. That is like using a un-calibrated power meter to test and calibrate another meter. It is just stupid!
I've seen people screw up the test code. In fact there are youtube videos showing people do that. But lets say you want to modify the way something works so then you have right more test code just to update that function or class or first. I've never once seen the best code result come from TDD. It instead encourages people to look at only small issues rather than look at the larger picture in solving something. So rather than end up with some efficient code you end up with many if else nest piles of crap for code that people wrote because they make these incremental changes to comply with the TDD testing changes. By the time they get to the point were they have something working they don't want to go through and do the work of refactoring the primary work to improve it and choose to just leave it as is. You end up with 3 to 10 times the code written just to get the same project done. You wonder why your over budget and costs are going through the roof. The only programmers i know who love this crap are amateurs and people getting paid by the line or hour in code.

GRHmedia
visit shbcf.ru