• no (unregistered)

    If anything goes wrong, we rollback the transaction and chuck an exception up the chain.

    worse, we silently gobble the exception up, throwing only if rolling back fails!

  • (nodebb)

    RIP, transactional wholesale triple caller

    So that's "Rest in Perdition" ?

  • Scragar (unregistered)

    A shocking number of people do redundant empty checks, I used to work at a place that used jQuery(back when it was semi-popular), and it was the coding standards to always check if the length was empty, and if so replace it with null.

    This resulted in code like

        var $list = $("#list");
        if ($list.length == 0) {
            $list = null;
        }
        if ($list != null) {
            $list.hide();
        }
    

    Instead of the much simpler and obvious:

        $("#list").hide();
    

    I complained about it so often but the tech lead at the time really didn't understand how anything worked and insisted we do what he knew worked rather than trying to change things to make them better.

    He was also the person who thought the observer pattern meant we should pass the list of listeners to be triggered to the observer ala:

        InventoryRepo.add(newInventory);
        InventoryRepo.save();
        Observer.trigger(Observer.Events.Inventory.Created, newInventory, [
            TriggerEtlOnNewEntityListener,
            RecalcStockListener,
            UpdateInventortCacheListener,
            ...
        ]);
    

    It took us 2 weeks to convince him that maintaining the list of events everywhere they may be triggered is exactly the problem the observer pattern is supposed to solve, and that if we don't stop it we are no better off than before we wanted to introduce the pattern.

    It was interesting to say the least.

Leave a comment on “Find a Bar for This One”

Log In or post as a guest

Replying to comment #:

« Return to Article