Jump to content

Creating a UML Class Diagram of existing code

Shally
Go to solution Solved by minibois,

The way I have always created class diagrams for existing projects is first:

1. create panel (not sure if that is the right word) for each class (usually I create the abstract classes and interfaces here too)

2. Add all of the function/methods to that panel (you can choose to not include private functions, as the UML is there to show how classes interact - not necessarily to show all function a class has. But consult the person who gave you the task for this)

3. Add all properties (whether to include private stuff/class variables is a similar story as above)

4. Add the most obvious connections to this UML, including the cardinality

5. Add the less obvious stuff together by checking the code thoroughly.

 

Especially the last step is quite time consuming, which is why you would want to create and maintain an UML beforehand/during your project.

Hi Folks,

For a large project of mine I've been given the task to create class diagrams for existing projects similar to mine. I honestly know very little about class diagrams but I'll be willing to put work in there. 

For example, I have to create a class diagram for this website. I wouldn't even know where to start in such a project. Literally any hints or pointers would be very much appreciated!

Irish in Vancouver, what's new?

 

Link to comment
Share on other sites

Link to post
Share on other sites

The way I have always created class diagrams for existing projects is first:

1. create panel (not sure if that is the right word) for each class (usually I create the abstract classes and interfaces here too)

2. Add all of the function/methods to that panel (you can choose to not include private functions, as the UML is there to show how classes interact - not necessarily to show all function a class has. But consult the person who gave you the task for this)

3. Add all properties (whether to include private stuff/class variables is a similar story as above)

4. Add the most obvious connections to this UML, including the cardinality

5. Add the less obvious stuff together by checking the code thoroughly.

 

Especially the last step is quite time consuming, which is why you would want to create and maintain an UML beforehand/during your project.

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, minibois said:

1. create panel (not sure if that is the right word) for each class (usually I create the abstract classes and interfaces here too)

Firstly thanks for the reply! I'm struggling to figure which classes I should be creating a panel for? Or what files even? There's a lot to unpack in the GitHub repo I linked so I'm a little confused.

 

 

13 minutes ago, minibois said:

which is why you would want to create and maintain an UML beforehand/during your project.

Also I'm creating UML off other solutions as to base my own off of! For my own implementation I'll have already created the UML diagram before coding. 

Irish in Vancouver, what's new?

 

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, Shally said:

Firstly thanks for the reply! I'm struggling to figure which classes I should be creating a panel for? Or what files even? There's a lot to unpack in the GitHub repo I linked so I'm a little confused.

yea, I'm having a bit of a hard time too, figuring out where to start and such.

From looking around it, seems like the .sol files are the main code-files. Mostly I work with C# projects, where I would just open the program in Visual Studio, check the Program.cs file and go check from there how the program works and what is connected to what exactly (via references).

 

I'm not sure though what to tell you here though, sorry :s

12 minutes ago, Shally said:

Also I'm creating UML off other solutions as to base my own off of! For my own implementation I'll have already created the UML diagram before coding. 

Oh yea for sure, that was really not targeted at you! More at programmers that do not have any diagram to speak off, because just having a start to a diagram makes it so much easier to work with code..

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, minibois said:

yea, I'm having a bit of a hard time too, figuring out where to start and such.

From looking around it, seems like the .sol files are the main code-files. Mostly I work with C# projects, where I would just open the program in Visual Studio, check the Program.cs file and go check from there how the program works and what is connected to what exactly (via references).

 

I'm not sure though what to tell you here though, sorry :s

I'm happy i'm not the only one!

 

The Solidity files are my main focus but after speaking to a supervisor he recommend me do the class diagrams for all the files. That's what really stumped me, since it seems the .sol files seem to be the focus for the project as well. 

 

I'm glad I wasn't the only one, and thank you for you helpful responses! 

Irish in Vancouver, what's new?

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×