Configurability

Published on December 19, 2010

Configurability

    Narration in an art or colloquial style on a computer theme is not a new thing. 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 scrum”. The fact that no one understands what it is for 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 are zealously observing it . Well, scrum, so scrum, you call the process at least RUP, don’t shut it down with thousands of reports.

    At the next stand-up, I stand aside, don’t touch anyone, at that time the people are discussing the pieces of a project, and then Slavka (our leader) remembers my existence, turns to me and says:
    - Serge, now you’re nothing not particularly busy?
    “Yes, it seems, no,” I answer carefully. “That week, Mat promised me to make some reasonable assignment, but he still didn’t, so I am sitting and fooling around little by little.
    “Excellent,” says Slavka, “I have just something for you to do.” Will you take
    “Well, why not take it, once it is something.” Come on, of course.
    - Look, are you aware that we are rewriting this Loader from pluses to sharpe? So, the customer starts with boiling water, 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, and that very often they had to make edits? - I ask.
    “Yes, he’s wrong,” replies Slavka, “The people say that there were no requests for changes at all, because they were afraid to get into this r # $ @ o-code. So I don’t know how useful this is, but I know for sure that they don’t want anywhere without configurability.
    - Okie, give me a day, I understand the code of the old system and what you have already done for the new version, but I'm wondering if it's worth screwing this configurability here al no.

    Alright, the code is so code, C ++, so C ++. Nothing was terrible in this code, except for the five-page function, and the specification of exceptions, which is considered as evil no less than the well-known sending operator to hell, however, those developers were fearless and didn’t scare such trifles. So it’s not surprising that the logic that the new version wanted to push into this configurability flowed like old warm oil into a frying pan, and in fact it turned out to be much more complicated and looked more like pieces of business logic rather than a simple association between the entrance and the exit.

    “Damn,” I say to Slavka and the other guys the next morning. “Still, why the hell do we need this configurability right from the start?” Why not add it later, when we will definitely know the logic of our application? Indeed, in the old apliche, a dofig beech and we may well miss something valuable inadvertently. Why not make it simple, cover it with tests, show it to the people, and then replace the implementation of several classes from the hardcode with reading from the config?
    “Earrings, how can I tell you,” Slava gloomily declares, “I’ve already tried three times to convince our customers to score on this feature, or at least transfer it to the second iteration, but they’re not at all.
    “Yes, this is complete crap,” I continue to be indignant, “How are they not happy with the configuration in the second iteration?”
    “They believe that we will have to rewrite the floor of the system if we do not do it right away,” Slava replies with a shrug.
    “Well, damn it, if you write in one place, you’ll have to completely rewrite it all,” I insist.
    “Why are you worried about this at all,” Sasha intervenes in the conversation, “don’t you care, well, the customer wants it, let's do it, and let’s forget about it ...
    ” “Yeah, we (and not only ours) have everything the systems are written in one place precisely because they don’t explain to different hoteliers what their desires can lead to, - I won’t stop. - So we get the systems that need to be rewritten after the authors of the systems dump from the office. What we see in our particular case.
    “In general, so,” says Glory. “Of course, you can try once 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 effort and time on its discussion.
    - Okay, but since I did not participate in the previous discussion with the customer, let me try it all the same once.
    - Well, ok, go for it. Just don’t tighten too much. Let's discuss this with them at today's meeting, ”says Slavka. - Do you have enough time, what kind of document do you need to pile by this time?
    “Yes, quite,” I say joyfully, secretly hoping that it will come out for me to do what my colleagues did not succeed before.

    Well, dokumenty sculpt, it's like rolling down a mountain. In a few pages, I state my thoughts on what all sorts of Buchs and other Lippers teach. Say, why the hell to do something difficult initially, if you can always add it, simply shoving this crap as part of the implementation and hiding it behind some kind of interface. In general, it is wise 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 confidence that the system works as required by the specification (even if it does not exist in a formal form). Moreover, all these stages are needed anyway, regardless of whether we will do configurability or not. It turns out that there is only one question:

    Okay, the document is ready, approved by the guys. We look forward to the evening rally.
    - John, Scott, good afternoon. Here we had additional thoughts about our configurability, 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 not bad, and authoritative links, but, alas, the arguments are not convincing ...
    - How not convincing, - I intervene and try to tell about all this again ...

    - Damn, they just do not give a damn! - I am indignant after the rally. - What is there, nafig, simplicity! Yes, there you need to parse expressions, and not to use simplexemeline. - Opening the old source and poking a finger at the code page, I am indignant after the rally. - There is no direct correlation between input and output, there are two buckets in the source system, and they want to push all this into the configs!
    “Damn, that's cool,” Kolyan joined the conversation. - Right now we will find some thread of the expression parser, screw it and all things!
    “Yes, and you can still use CodeDom to do it,” suggested Slavka, either as a joke or seriously.
    “Yeah,” I supported the guys, “And are there any more sophisticated methods of suicide besides cutting off your limbs with a rusty saw?” This is from a gun on sparrows! To screw all crap for the sake of checking two dozen conditions that someone wants to make in the config! Moreover, no one even knows how often these conditions will change or be added.
    - Do you imagine the debug process, when the user tells you that your arcade system does not work as it suggests? - I do not give up. - You won’t put a gag in gonfig ...
    - Well, what remains for us? - Glory tries to calm me down. “In addition to citing several implementation options, each with its own pros and cons, and inviting them to make their own choices.”
    “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 their own, even if they do not agree with him. That's all, I went to look for normal solutions with this, damn it, configurability ...

    ************************************ ***

    - Well, how did this story end? - Sanya asks impatiently. - So were you right or not? Was there any sense from this configurability? At all, at least someone used it? - Sanya chattered excitedly.
    “Wait, Sanya, not so fast,” I answer with a smile. - I did prepare several configuration options, three options for deserializing .net expression trees from a text view, and one more - in the form of reading the truth table from the config. They discarded the option without configuration right away, so estimate it, I spent even more than an hour convincing them that in our case the full truth table would occupy a dozen pages and would be completely unreadable. And only due to the fact that it was the option with the table that was proposed by one of the customers.
    - So what did you stop at? - interrupts Sanya.
    - We still managed to convince that parsing expressions using Dynamic LINQ is a normal option, which will be the compromise between readability, extensibility and testability. And the funny thing is that it took much less time to implement all this configurability than to discuss its necessity. But it seems to me that we spent time not in vain. If we tried to implement this task head-on, in the form that the customer initially wanted, we would get problems in implementation, not to mention testing or support in the future.
    Even in this version, we have already encountered the difficulties of debugging and diagnostics, but due to the fact that I save not only compiled functions, but also the expressions themselves, catching “fleas” is a problem to be solved.

    I don’t know if 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, looked at the customer, and found a very good solution to the problem. We did the main thing, we didn’t knock out any of our solutions in stone and any thing that could potentially change is hidden inside behind an abstract interface. So the chances that any decision can have a significant impact on the life of this project are small. I think that everything will be fine with him, and he will not have to rewrite it again when someone needs to correct several lines of code in it. In general, everything will be OK with him, where will he go now, from a submarine :)

    via Programming Stuff