I recently had fun with replacing a custom video plattform ("mycustomtv") in one of our applications. I learned a lot about naming stuff.
youtube_mycustomtv_chooser
is a bad name for a directive.
Why?
- if you add, for example, other video systems like vimeo, the name of the method either lies or will get longer.
- if you replace one system, you will have to change the method and all of its occurrences (and you're very lucky if it is only one poorly named thing in your application)
What would be a better solution?
Abstract from the systems you use. For example: video_type_chooser
. Abstracting from system and application names also makes your code more reusable.
I think it's good not to abstract for something like an importer, that really only is used for your custom system. Just don't name everything in your application like your custom system. And also don't name everything in your application like your application - it does not add value but makes code harder to adopt for different use-cases.
[/rant]
Posted by Judith Roth to makandra dev (2018-01-16 08:55)