loading...

This post is private

mscharl profile image Michael Scharl ・1 min read

A developer's diary (2 Part Series)

1) Starting the year off 2) This post is private

I recently stumbled upon a service class provided by our project framework which I had to use to implement a new feature into a project. It was quite a large class but that's fine because it takes away a lot of effort for me.

There was just one problem. I needed one tiny line to be placed inside a function of this service to make it work seamlessly with my existing code. Unfortunately, there was no way to hook into the function in any way. So usually I would extend or decorate the function and overwrite it in the dependency injection container. Sound simple. Just extend the class, overwrite the function, add the custom part and done.

Instead, it wasn't. Because someone made all properties and methods (except for a few) private. Which means I have no way of accessing anything from my subclass. WHY WOULD YOU DO THIS. If you create a framework and provide services and stuff. Don't assume that you thought of every use case possible.

Now I had to copy the whole class just to insert a single line! This not only makes me a bit angry but also is really ugly 🤮

A developer's diary (2 Part Series)

1) Starting the year off 2) This post is private

Posted on Feb 27 by:

mscharl profile

Michael Scharl

@mscharl

In the office I care about creating beautiful and functional Applications. At home I care about my beautiful wife and lovely children.

Discussion

markdown guide