Hey everybody, I’m currently groing through Andreys PR (https://github.com/apache/incubator-plc4x/pull/27) which introduces some very good API changes and makes the API a lot more concise. But one thing that annoys me from the first day on plc4x is still there (and is now even more annoying as the rest is so clean). It is the boilerplate code I have write all the time when “just doing a connection to read something” due to the Optional<?> for getting the reader (or now the ReadRequestBuilder). For me, the getReader (or now readRequestBuilder) as Optional is like what Sebastian hates about Checked Exceptions. I never had to deal with a Connection which did not have a Reader but I had to check the Optional… at least 50 times, perhaps even more.
Can’t we come up with a solution for that which would make the API (from my perspective) even more clean and user friendly. Suggestions could be: 1. Replace the connection directly with Reader, so no getConnection but getReader (or readRequestBuilder). And if this fails, it throws a PlcConnectionException, as usual. 2. No optional but another or canRead() method (for those who like it save) and it then throws a unchecked PlcConnectionException (or some subclass) What do the others think? Is this only me having the feeling that this is the same anti-pattern as with the checked exceptions? Julian
