Hacker News new | past | comments | ask | show | jobs | submit login

Ha! I once reduced a 10,000 line module in a Broadcom 802.11 driver to one page - a template to construct a message. Calls to the old code (5-6 lines) went to nothing - simply pass your structure to the message API.

But that was an eggregious driver. Previous version: ~15 modules. Rewritten by some purist: 900(!) modules. I kid you not.




Please tell me more! How come the calls to the old code went to nothing? It does not surprise me but I wonder how it happened in this specific instance.

Who did the 900 modules rewrite?


Instead of declaring a message and creating it with a call to the (now obsolete) module specific to the structure being transmitted, one simply passed the structure to the message-send api. The conversion template to 'Message' automatically rewrote the structure argument as a message argument.

I was re-writing the driver as a simple C++ set of pure virtual objects and implementations for my hardware. So when I scavenged code to send a certain structure as a message, I simply didn't make the old calls. I remember I did (for some reason) edit all the old modules to use the new API, to prove it still worked I guess. A long afternoon of search and replace.

The (Korean?) company that owned the driver must have had a team or something. It was extremely brain-dead code for every element of an 802.11/ethernet abstraction as a separate module, done twice (once for the driver; once for the module firmware). Double structure definitions for everything.

My team wanted a walk-thru of the existing driver. I scheduled two hours, one before lunch and one after. I opened with "I've brought just the 500 most significant modules today, and we're going to walk thru a connection and message send". Proceeded to open dozens of nested module references on a very long path from triggering a connection attempt to exchanging the first message for negotiation. The hour was up.

Nobody came to the 2nd hour after lunch.


> Double structure definitions for everything.

I wonder if that's because two different teams worked on the two different abstractions.

> Nobody came to the 2nd hour after lunch.

I guess that the pain of that first hour convinced them that your rewrite was trustworthy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: