Monday, April 28, 2014

main() is a fractal dimension of semi goodness

Most of the  main() functions I've seen and implemented are typically just a few lines long and then immediately launch into the application. On the one-hand it plain to see that the thin layer acts as a way to match the impedance between the application and the underlying operating system. By FD (fractal dimension) one should also be implementing thin layers between the application and any other 3rd party library linked in.

On the other hand... if you migrate some code into the  main() function making it thick and actively implements some of the startup then... also by FD you could argue against thin layers between any part of the application and the 3rd party libraries.

I like the thin layers. They create the best opportunity to mock the target and write more test cases (IoC and Dependency Injection). Ick!! But then you gotta ask yourself whether or not a thin  main() makes any sense or if the compiler/linker should shorten the dependency.

No comments:

Post a Comment

prod, staging, QA, dev in your CI/CD?

I've been developing with CI/CD since before it was a straw, let alone a pipeline. No, graduates of 2020 you did not design or discover ...