|
|
|
|
|
by AdityaSanthosh
1122 days ago
|
|
So cool. I love rust and my day job is in Python. But I have a question. I'm a junior dev(gimme some leeway here). I don't really understand how important these design patterns are because in the programs I write, I usually write the classes and call them in runtime myself. I think usually we write the servers and client ourselves. Let's take the different client types example. You are making an assumption that users can call close on a closed client. Is it so hard to just follow the sequence `
client = Client() client.connect() client.authenticate() client.send_message() client.close()
` Aren't they overengineering? Perhaps I have not worked in a large code bases to understand the problems TypeState Pattern or more generally these design patterns solves. I understand that these patterns are elegant and make the future modifications or enhancements easier but I have never seen the tangible value enough in real life |
|
One of the biggest learning moments in my work has been collaborating my past self. You need to have stepped away from some piece of code for a while to get this. If the code is not well organized you will think an alien wrote it.
It's only over time you realize that "it works because I know how to use it" is actually a problem. Over time you also figure out how to write the code in a way where you aren't surprised at your own decisions.