A line of Code

A whole lot of Tech conversations take place within the My Dream Store team and we would like to bring these conversations here, so that we can include the larger tech community in our conversations and learn from each other.

Here Harsha M, our Developer, talks about the inner workings of our design studio.

this._waiting.splice(this._index, 0, cb);

Bug fixes are usually a couple of lines of code. It’s rare for a feature to be the result of a line. Of course a line is meaningless without its surrounding code.

You see that line makes the callback hell vanish for saving a design using design-tool  !

For saving a particular design the following steps have to happen in order.

1. Save Front side
1.1 Freeze Front side
1.2 Freeze Design area
1.2.1 Freeze Text
1.2.2 Freeze Filters

2. Save Back side
1.1 Freeze Back side
1.2 Freeze Design area
1.2.1 Freeze Text
1.2.2 Freeze Filters

3. Capture Goal Information

That’s a minimum of 10 callbacks, all deeply nested. At this point the various promise libraries didn’t seem to keep up.

Now Mutexes are complicated enough. That line gives you (quasi) Mutexes with arbitrary nesting unlike the original. I am not competent enough to call them Nested Mutexes, but fiddle out and let me know 🙂

@harsha_mudi

Watch this space for more such Tech Conversations!

Comments ( 0 )

    Leave A Comment

    Your email address will not be published. Required fields are marked *