|
|
|
|
|
by yotamoron
1385 days ago
|
|
Really? NullPlane? Are those the remains of the plane from 'Lord Of War' after it landed in the middle of no-where in Africa? Come on, that's a laughable content. A much better way to do it would be to create a factory registry, let each plane type register itself to it (using dependency injection) and have the factory just call the proper builder (and yes - crush and burn when an unknown plane type is passed) when getPlaneInstance() is called. This kind of code and posts make me angry. Its a bad example of a bad pattern, done by a sloppy and inexperienced engineer. The 'O' in SOLID is for 'open for extensions, close for modifications' - I guess that proudly showing off code that completely breaks it is a source of pride. |
|