I've used them only when I was discussing the architecture with other colleagues. But that happened less than 5 times in last 10 years.
Do industry professionals really use UML diagrams before coding?
I was viewing some videos about UML diagrams and wondering whether the industry professionals actually use these sorts of diagrams to represent the software design. Are these diagrams still relevant in the industry ? Are there any other approaches that take place between requirement and coding phase ?
@gitwithravish Interesting question.I consider myself a professional, but I find myself in a role where I'm a sole developer for a mid-sized corporation. This has advantages of giving me incredible freedom to go whatever direction I feel is best, but of course, there are disadvantages - no delegation, more pressure to resolve issues, no one to cover on vacation, etc.. but I'm getting a bit off topic.
Since I work alone, I'm often curious about processes such as this. Personally, I've always found UML to be a waste of time. I used it once about 9 years ago, where it eventually ended up in the garbage. Having said that, as others have pointed out, I think it could have uses in other scenarios - such as trying to build a diagram that is universally understood.
Anyway, when it comes to your question regarding how software is designed... what I do for features, is I take a TDD approach, and write out the code within the controller. Once tests are passing, I then focus of refactoring to additional layers: interfaces, service classes, view composers, etc. I like try to stick with the "skinny controller" philosophy as much as possible. I rarely/never start off with a complex OOP structure; it evolves on its own thru refactoring, backed by tests. The more you become comfortable with all the different tools within the framework, and design patterns, it becomes easier to decide what direction to take. By using a MVC framework, it helps keep developers adhering to main conventions. There are just some of the minor ones that need to be worked out as a team.
A few examples of such conventions:
- Singlular or pluralized controller names (PostController vs PostsController)
- If using Blade, some like to prefix partials with an underscore, some like to make a sub directory
- Trait naming, such as always making them adjectives (Notifiable, Exportable, etc)
- Middleware to be defined on the route level or controller constructor
- Determine how strict the code will adhere to SOLID principles (i.e.: Laravel's complex models break the Single Responsibility Princicple, but many consider the convenience to outweigh the violation)
- As per above, some have no issues using ORM, others use the data-mapper pattern
The important thing is, that everyone understands what conventions are being used, and to remain consistent.
Please or to participate in this conversation.