-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create plug-in interfaces for http-request
, http-response
, http-headers
#37
Comments
Creation of a http-client library to be used as the interfaces for REST and specific http clients. |
@jimkring @jyoung8711 Context: Some possible variants:
Now that I`ve listed a few, my preference would be for :
Dot Extension for class hierarchy? BasicHttpClient vs HttpClient.Basic Definitely nice for maintainers to follow the trace of what inherits from what. Easy to sort on disk when dot notation is used. Classes too? It makes for longer names and users of the library might not care much? |
Great ideas and an important discussion! Here are some thoughts:
With all of that said, I also should mention that, for some reason, my brain does not easily parse the words in camelCase or PascalCase, especially when I’m looking at a bunch of files on disk. However, my brain may work differently from most :) I’ll continue to think about this, and I’ll look for other resources on what standards others are currently adopting… |
Good / Interesting Discussion on here My feedback is basically derived from what I've practically experienced in how we use these types of libraries as build artifacts : We work almost exclusively with PPLs for re-use libraries. In extended structures, it is often very helpful to have a level of uniformity in related library names. PPLs tend to end up in one giant global folder for ease of use/access, so it's very useful to be able to quickly find and interpret what you're seeing from that perspective. As a consequence, we've found that prefixing related libaries with the same name has a lot of value... so something like:
Would be my strong preference. edit: one slight alternative I've used here in the past is to "shorten" the prefix on any follow-on classes, so the logical grouping is still clear, but name length is reduced (httpClient, http-NIAdvanced, http-NET for example). This maintains the logical grouping, while not keeping things as strongly linked as @jimkring mentioned above I've found that I've developed a fairly strong aversion to "." characters in file names (especially stuff that end up as build artifacts... like PPLs) as it can also occasionally upset filename parsers, and have shifted to either hyphens or underscores. My other recommendation is that Library name == Primary Class name for extended classes: This helps if there's a need to dynamically load the classes, as you only need to keep track of one thing. This would not apply to the main "interface" library which also tends to contain a couple of sub-classes, and will already be in memory anyway. I don't have a particularly strong preference on camalCase vs PascalCase vs -/_ . I mostly use PascalCase on my day-to-day development, with "User Facing" APIs having spaces in the names (exactly for the previous point on it being easier to read/interpret). |
I think you may have meant Wrapping extension classes (plug-ins) in an One thing I like to do for for plug-in (concrete implementation) templates put the specific name ONLY in the lvlib name, like this:
Note that the lvclass'es inside the lvlib all have the same name as the base interface that they are implementing. The main reason I like this approach for plug-ins is that instantiating a new plugin from the template involves simple copying the plugin-template folder and then renaming ONLY the lvlib: This: Becomes this:
I might also be OK with underscores instead of hyphens, if CamelCase is used for ClassNames:
Thus, it would get built to a PPL as:
I might also prefer to put the interface name at the end like this:
Side note: What would we do we do if a single class implements multiple interfaces?
For this last one, I guess that's why I don't have a convention for including the interface name in the concrete implementation, except informally. Thus:
Then, if we want to know what interfaces a plugin supports, we would interrogate it after we load i (test which interfaces it supports by either trying to "type cast" it to known plugin types or by calling a general |
I did. Thanks :)
I had not seen this before, or really considered this. I like the simplicity a lot. It would definitely make templating the interface/plugin a bit easier. It's amazing the simple options you can just completely overlook sometimes...
This is the options I would prefer to avoid most, mostly from the resulting folder PPL build organization. If you have a folder with 100 PPLs in it, finding the "HTTP Client" related ppls is a bit tedious.
Good questions, and to be completely honest, I think I've rolled out interfaces a grand total of 3 times in my own code use, and none of them have inherited from multiple interfaces, so that use case hasn't occurred to me. Most of the places where I could have utilized interfaces were developed before interfaces were available as a feature, and I didn't want to refactor. That said, I think for this project, it would be pretty unlikely to have multiple inheritance for anything provided here in order to reduce dependencies, so I don't think Id worry about that from the class/library perspective. I'm fairly agnostic about method names, though as long as we're avoiding any "known" namespacing conflicts, I think we're in pretty good shape. I thought the namespacing that @francois-normandin used in his initial version of this was pretty reasonable.
I think this is where my "edit" is coming from. I revised my previously stronger statement about the library MUST include the parent name to "it would be nice if it looked similar" in this case, just pulling the "http" nomenclature to the beginning of the name would be useful from an organizational function... which still fits, because likely all these things are really primarily Http libraries. |
Thanks @jyoung8711! 👍 |
No description provided.
The text was updated successfully, but these errors were encountered: