0

A couple of years ago I began a personal project aimed to simplify working with the JTOpen (JT400) IBM library, for communicating with an IBMi (AS400) machine. JTOpen site

The target file system was the QSYS one. Being a personal project I had not much time to think about the structure, so I just tought about the QSYS structure and I came up with this hierarchy.

enter image description here If you're not familiar with the IBMi architecture you can have a look here: AS/400 Objects and libraries

After several months I wanted to improve what I had done, but unfortunately I found it to be quite difficult, because of the "diamond" effect and because of problems caused by modifying a base/abstract class.

Now I'm wondering, is this a clear case of the "composition over inheritance" matter? How could this be structured with composition?
I find that I'm too much into OOP that I cannot think about different solutions, and looking over the internet there is not a clear example (just a bunch of "Fruit" or "Animal" examples).

LppEdd
  • 20,274
  • 11
  • 84
  • 139
  • 2
    This *may* be better suited for either https://codereview.stackexchange.com or https://softwareengineering.stackexchange.com – luk2302 Jan 14 '18 at 14:30
  • @luk2302 I will move it as soon as others start complaining or requesting it to be closed. Thanks! – LppEdd Jan 14 '18 at 14:33
  • Your problems are the reason why today inheritance should be avoided. Especially if you have a deeper class structure your raise the chance for required modifications in base classes. It could be okay for personal projects but if other parties depends on your code it brings only trouble. – OkieOth Jan 14 '18 at 14:37
  • @OkieOth I'm working with Rust as of now, after many years of Java/C++. Rust has no real OOP concepts (just traits-interfaces). That's why I'm thinking about a composition approach on what I've already done. – LppEdd Jan 14 '18 at 14:43
  • 1
    I do not think that it is **deeper enough**. There are many Interfaces in your model. Please see my recent explanation about **wrong Inheritance** [here](https://stackoverflow.com/q/48092447/6390798). Maybe helps. – Gholamali Irani Jan 14 '18 at 14:47
  • @luk2302 when referring other sites, it is often helpful to point that [cross-posting is frowned upon](https://meta.stackexchange.com/tags/cross-posting/info) – gnat Jan 14 '18 at 20:06
  • I find this question interesting. I don't know which site is the "best" host for it, but I'm personally glad it was here, because I don't have accounts on the other ones. ;) And as far as I know, this is probably the most likely place in the Stack Exchange network to catch the eyes of some IBM midrange experts, and I believe their expertise is relevant to this question. – John Y Jan 15 '18 at 04:21
  • @JohnY You're right, someone who has worked much longer than me on the IBMi ecosystem is going to have a much more clear view and potentially can suggest better solutions. – LppEdd Jan 15 '18 at 08:04

0 Answers0