I was reading some code and it took me hours to figure out what the code was doing.
So the code used a lot of functional coding techniques that I was not familiar with. This meant I had to learn what the code was doing. Unfortunately this was not the first time I was looking at these same 100 lines trying to figure out what the author was doing. I bet I have spent over 100 hours on these 100 lines in total.
I soon noticed I was cursing the code. Historically for me this is not a good sign and means I am getting frustrated. So I stopped and asked myself is the code bad, or is it me? This is a tough question, that is what is good code and what is bad code?
Some say that working code is good code. I agree that working code is important but if others can not understand the code it is not good code as no one else can maintain the code. Therefore code has to be functionally correct, but also it needs to be understandable.
Note functionally correct is more than just working, it also has to handle errors gracefully, or at least within the over all project parameters.
This brings me back to the code I was reading, I could not understand the code, does that mean it is bad code? So the answer is really it depends on the team. If I am the most experienced developer on the team and use techniques that other team members can not understand then I am writing bad code. That is when you write code you are writing code to be understood by your team. If you write code beyond your team's understanding it is bad code. If you want to write code at that level you need to bring your team's abilities up to that coding level.
So for my problem the question then becomes one of where is the team's coding ability? I know I am not an expert on this particular programming language, so can other team members understand the code? If not it is bad code that needs to be refactored.
So then I was asking why do I not know if other team members understand this code and where they are in their abilities. I quickly realized that we did no code reviews and so we have no idea where each other's abilities are. We also know very little about each other's experiences, past, and capabilities.
I quickly realized that this project was most likely going to end badly. The lack of code reviews and knowing teams abilities meant we were not a team but a collection of individuals. That is without the leadership and team development in the code it was really a free for all. Each developer was doing their own thing and changing the code as they saw fit. In effect we were all in the boat, and each person was rowing the boat the way they felt like going.
The best analogy for this project is that you hired a bunch of construction workers and said build me a house that looks like this. However you never did the architectural plan for the house, or any real planning. Thus the framers are building walls at same time foundation is being poured and everyone is wondering why it is just not working together.
Once I realized this the hindsight of the past became clear. That is you often get a nagging feeling with projects that something is wrong. You just can not really vocalize the problem into a statement but rather you know something feels wrong. When you finally figure out what feels wrong it is like a picture suddenly comes into focus. Once you reach this moment of clarity is when the real problems start hitting you. For myself as an individual contributor to the team I have to either accept that this is the way it is on this team or work to change it. If/When you accept it as the way it will be, then for how long will you be able to survive in the environment?