Tracking Down Progressively-Enhanceable APIs
willhbr.net·6h
Flag this post

Something that I’m a big fan of is APIs that can be easily modified and hacked with. It’s frustrating to have to write fully production-ready code when you actually want to just prototype something, and so I’m happy when there’s an API that it’s easy to use, which then progresses into a more full-featured API.

In Crystal an example of this is File.read. If you want to get the entire contents of a file you can just do:

contents = File.read(path)
# process contents as a String

Will this cause problems if the file is huge? Probably, but it works fine for a prototype or in something less critical. Then when you want to be a grown-up and do things properly, the API doesn’t actually change that much:

File.ope...

Similar Posts

Loading similar posts...