The narrative in the artistic or conversational style on a computer theme is not new. Probably one of the first and most famous representatives of this genre is Tom DeMarco with his wonderful book “Deadline. A novel about project management. So I decided to try this style on myself and see what comes of it.
The first days of work on a new project is another stand-up. We, you see, are working "on a scram." The fact that no one understands why this is needed and what benefits we get from this process is the second thing, but the main thing is that everyone (including the customer) knows that we have a “Process” and we follow it zealously . Well, okay, scrum, scrum, you call the process at least RUP, just don’t ask for thousands of reports.
At the next stand-up, I stand to one side, I don’t touch anyone, the people at this time discuss pieces of a project, and here Slavka (our leader) remembers my existence, turns to me and says:
- Serega, are you not doing anything special now?
- Yes, it seems, no, - I carefully answer. - Mat last week promised me to adjust some reasonable task, but I didn’t fit, so I sit and foolishly toil little by little.
“Excellent,” Slava says, “I have a job for you right now.” Will you take it?
- Well, why not to take something, since it is something. Come on, of course.
“Look, you know that we are rewriting this Loader from pluses to sharp?” So, the customer already comes up with boiling water, so he wants it to be configurable. Well, like, we registered something in the config, and it already somehow works differently.
“Well, okay,” I say. - The idea is reasonable, but what very often did they have to make edits? - I ask.
“Yes, it's his,” Slava replies. “The people say that there were no requests for changes, for they were afraid to go into this r # $ @ o-code. So I don’t know how useful it really is, but I know for sure that they don’t want to go without configuration.
- Okie, give me a day, I will look into the code of the old system and that you have already managed to make up for the new version, but I’ll guess whether it is worth screwing this configurational al here.
Okay, code is code, C ++, C ++. There was nothing terrible in this code, there were five pages of functions, and exceptions specifications, which are considered to be evil no less than the well-known sending operator, but those developers were fearless and their little things didn’t frighten them. So it is not surprising that the logic that they wanted to cram into this configuration in the new version flowed along the old code, like warm oil on a frying pan, and in fact it turned out to be much more complicated and resembled pieces of business logic, rather than simple association. between the entrance and the exit.
')
“Damn,” I say to Slawka and the other guys the next morning. - Nevertheless, why the hell do we need this configuration right from the very beginning? Why not add it later, when we already know the logic of our application? After all, in the old aplikuhe, bukav something dofiga and we may well miss something valuable by accident. Why not make it simple, cover it with tests, show it to the people, and then replace the implementation of several classes from hardcode to read from the config?
“Sereg, how can I tell you,” Slava says gloomily, “I have already tried three times to convince our customers to score on this feature, or at least to transfer it to the second iteration, but they are not in any.
- Yes, this is complete crap, - I continue to be outraged, - What is not satisfied with their configuration in the second iteration?
“They think that we will have to rewrite the system’s floor if we don’t do it right away,” Slava replies with a shrug.
- Well, damn, if you write in one place, then you have to rewrite it all, - I insist on my own.
“Why are you even worried about this?” Sasha interferes with the conversation. “Don't you care, the customer wants, let's do it, and let's score for it ...”
- Yeah, with us (and not only with us) all the systems are written through one place just because they do not explain to different helpers what their desires can lead to - I do not let go. - Here we have systems that need to be rewritten after the authors of the systems dump them from the office. What we see in our particular case.
- In general, so - says Glory. - Of course, you can try again to convince them that they are wrong, but I would not do that. In general, configurability does not seem such a difficult task to spend so much time and effort on its discussion.
- Ok, but since I did not participate in the previous discussion with the customer, let me try once.
- Well, ok, dare. Just do not tighten too much. Come at today's meeting with them and discuss it, - says Slavka. - Do you have enough time, a thread of documentation to pile by this time?
“Yes, quite,” I say happily, secretly hoping that it will come out for me to do something that my colleagues have not done before.
Well, documents to sculpt, it's there as a mountain to roll. On several pages, I set forth my thoughts about what all Buchi and other Lippers teach. Say, why the hell do something complicated initially, if you can always add it, just sticking this crap as an implementation detail and hiding it behind some kind of interface. And in general, it is reasonable to restore the old application logic, write tests, make sure that the module works as expected. Then change the implementation of the module and feed the new module to the old tests. So we will know that nothing has changed and there will be at least some certainty that the system works as required by the specification (even if it is not in a formal form). Moreover, all these stages are needed anyway, regardless of whether we will do the configuration or not. It turns out that there is one question: do we need to show the customer an intermediate version of the system, in which the logic will be embedded in the code or go straight to the implementation of cofigration, without showing this result.
Ok, the document is ready, the guys approved. We look forward to the evening rally.
- John, Scott, good afternoon. We have additional thoughts about our configurability here, did you read the document sent by Sergey? - Slavka takes the bull by the horns from the very beginning of the conversation. - What do you think about that?
“Well, what can I say,” replies Scott, the stakeholder of this project on the part of the customer. - Thoughts seem to be good, and the links are authoritative, but, alas, the arguments are not convincing ...
“It’s not convincing,” I interfere and try to tell everything about it once more ...
- Damn, yes they just do not fuck! - I resent after the rally. - What is there, nafig, simplicity! Yes there it is necessary to express expressions, but not simple to use. - Opening the old source code and poking a finger into the pages of the code, I am outraged after the rally. - There is no direct relationship between input and output, there are two buckets of code in the original system, and they want to shove it all into configs!
“Damn, that's cool,” Kolyan joined in the conversation. - Right now, we find a thread of expressions parser, fasten it and everything!
“Yes, and you can still use CodeDom,” suggested Slavka, either jokingly or seriously.
- Yeah, - I supported the guys, - And still there are some more sophisticated methods of suicide, besides cutting off your limbs with a rusty saw? Well this is from the cannon on the sparrows! Tighten all sorts of crap to check two dozen conditions that someone wants to put in the config! And no one even knows how often these conditions will change or be added.
- Do you imagine debugging process when the user tells you that your system is not working in the wrong way? - I do not quench. “You’re not going to break the gonfig ...”
- Well, what remains for us? - trying to calm me down Glory. - Except how to bring several options for implementation, each with its own pros and cons, and invite them to make a choice.
“Okay,” I say. - So be it. I will try to use the doctrine of the Marines, who must follow the orders of the command as my own, even if they disagree with him. Everything, I went to look for normal solutions with this, pancake, konfiguryabelnost ...
****************************************
- Well, what ended this story? - Sanya asks with impatience. - So you were right or not? Was there any sense at all from this configurability? In general, at least someone used it? - excitedly chattering Sanya.
“Wait, Sanya, not so fast,” I reply with a smile. - I did prepare several configuration options, three options for deserializing the .net expression tree (aka expression trees) from the text view, and one more - in the form of reading the truth table from the config. They discarded the variant without configuration right away, so count it up, I spent even more than an hour convincing them that in our case the complete truth table would take a dozen pages and would be completely unreadable. And only due to the fact that the variant with the table was proposed by one of the customers.
- So what did you stop at? - interrupts Sanya.
“We managed to convince us that parsing expressions using Dynamic LINQ is a normal variant, which will be the very compromise between readability, extensibility and testability. And the funny thing is that the implementation of all this configuration took much less time than the discussion of its necessity. But it seems to me that we have not wasted time. If we tried to implement this task head-on, as the customer initially wanted, we would get problems in implementation, not to mention testing or maintenance in the future.
Even in this version, we are already faced with the difficulties of debugging and diagnostics, but due to the fact that I save not only the compiled functions, but the expressions themselves, catching “fleas” is a solvable task.
I do not know whether configurability is useful in practice and how much it will complicate the understanding of this part of the system in the future. But it was interesting for me to work on this task, I figured out a bit with Dynamic LINQ, got involved with the customer, and found a very good solution to the problem. We did the main thing, we did not cut down any of our decisions in stone and any thing that could potentially change is hidden inside behind an abstract interface. So the chances that any decision could have a significant impact on the life of this project are small. I think that everything will be alright with him, and he will not have to be rewritten again when someone has to correct a few lines of code in it. In general, everything will be OK with him, where he will go now, from a submarine :)
via
Programming Stuff