5 karma · joined February 12, 2018
So 1st, make questions, understand what is the objective with that code you see on screen. 2nd, make more questions too see if other use cases were considered.
3rd, there are best practices, literature that provide a common way of working, discuss how to apply this.
There are no ways of understanding without making questions.
On this specific case, besides the lack of OO design knowledge, there were also a misunderstand on the page object pattern , how web apps are build and what is the web app and what is part of the browser.
And this is why I also talk with my team on my ideas to develop something before or while developing it. It should not be a surprise, no matter how nice and commented the code is.
My approach is to ask the person question and understand what is the objective trying to be achieved, and hope with the answers given, the person realize it is doing a mistake.
I also hope that the person respect my experience and is able to learn from my mistakes and do not need to do the same mistakes in order to learn.
But I do not always succeeds in these endeavors. Once a colleague was developing some page objects for Selenium tests and creating classes with only one attribute, which was the full URL of the page. Of course tests would not word when executed in several environments and to have this files were useless. But to fix exactly this, I saw it required more knowledge on OO design than a simple talk could give.