Article 55GCG CodeSOD: A Private Matter

CodeSOD: A Private Matter

by
Remy Porter
from The Daily WTF on (#55GCG)

Tim Cooper was digging through the code for a trip-planning application. This particular application can plan a trip across multiple modes of transportation, from public transit to private modes, like rentable scooters or bike-shares.

This need to discuss private modes of transportation can lead to some... interesting code.

// for private: better = sameTIntSet myPrivates = getPrivateTransportSignatures(true);TIntSet othersPrivates = other.getPrivateTransportSignatures(true);if (myPrivates.size() != othersPrivates.size() || ! myPrivates.containsAll(othersPrivates) || ! othersPrivates.containsAll(myPrivates)) { return false;}

This block of code seems to worry a lot about the details of othersPrivates, which frankly is a bad look. Mind your own business, code. Mind your own business.

proget-icon.png [Advertisement] Ensure your software is built only once and then deployed consistently across environments, by packaging your applications and components. Learn how today! TheDailyWtf?d=yIl2AUoC8zA9YS98r5V0gg
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments