简体   繁体   中英

Not exactly following what is depicted on project UML diagrams

This has been confusing me for quite some time. I have an app which is already done, but since the client is looking for a detailed documentation of it, I now have to create diagrams. The point where I get so confused is, whenever I make the diagrams, it just seems that the diagrams are not as exactly the same as what my coding looks like. For example, on my class diagram, I have a class called 'announcements' and under that class is a method which getAnnouncements(). But in actual coding, you'll never find a method that is named getAnnoucements() since I opted to not create a method for it and instead put the codes directly on the main class. I know it's not a good coding practice, but what if? So these are my questions: Do I really have to follow what is on the class diagram? Or since I'm using reverse engineering, do I have to follow what is on my code and make diagrams of it?

If you're making a documentation and you're making a UML at the code level follow whatever you actually have in the code.

The benefit of this approach will be that

  • you really have diagrams similar to your code
  • you (and your client) will be able to recognize parts of poor code (ie not following various standards) - like those you describe. It gives chance to improve it in the future

The drawback is that you might need to correct the automatically generated diagram. Each time you generate it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM