Modelling tools and their capabilities
Why would you even bother using modelling tools and technologies? :
1. Using modelling tools keeps track of how your classes/flow/environment will look like and how they will work with each-other.
Check information from University of Cambridge about Software Design - course materials.
2. Designing software will push you to think-through about specific components in project.
You will probably think about elements in project, but human-beings have more visual-memory developed, hence I'll present you something:
3. Creating complex software-engineering system needs some documentation and proper design.
Think about NASA - if they would not design and keep documentation, how would they be able to comunicate with engineers in space and help them with problems they are facing day-by-day ?
Plan for the spacecraft that was designed at 21 May 1959:
4. You can reverse process and instead of using UML only for modelling, use it for creating source code.
In my professional experience I've used DIA some time ago. You can even read content of the dia diagrams - because they are simple xml files.
Ofcourse you may be sure that dia2code will only reshape your diagrams into simplest classes with methods, but you will need to fill it with some juice-source-code
Why use reverse-engineering tool like pyreverse ?
1. You need to investigate a source code that you haven't created and code has more then 10 classes and relationships between them.
I.e. You get involved in new project. Projects has already some code that is hard to read and understand in first hand. You may find yourself reading and analysing source code and creating flow blocks how code works, that reverse-engineering tool could do for you in almost snap-of-a-finger.
Making example in real-life - you want to know what are pelican source-code relations to better understand how it works:
git clone https://github.com/getpelican/pelican pyreverse -o png -ASmy pelican/pelican/
Output is big - it contains all classes , it's methods and relationships, hence it's approximately 2MB.
Let's make a more sliced up example, previous version contained test classes that let's say for this example don't have particular usage.
So how to ignore this files ?
Check asciinema video:
Tests are located at directory pelican/pelican/tests, hence to ignore them, we needed to add
You can use
--ignore multiple times. Take only into account that you need to use relative path - instead of i.e.
pelican/pelican/tests - simply
2. Want to have visual presentation of what has been already created.
You want to see how your classes and methods looks like outside of programming language context ??
Check reverse engineering tools to read your classes from source-code.
First we need to add dependencies to our run environment to make pyreverse work properly.
Pyreverse has been integrated to pylint from 0.5.1 version.
Biking-Endorphines already has pylint integrated in requirements.txt, hence for this project I will not need to install it.
If you would need to integrate pyreverse to your project, here are instructions:
apt-get install -y graphviz apt-get install -y python-pip pip install pylint
Pyreverse on Biking Endorphines.
1. Normal usage, see example at asciinema!
Result (for web-project):
2. Specific class only:
But you can also do a specific class research:
pyreverse -c User -o png bikingendorphines/web/models.py
Code commits done for this post:
Since I still haven't figure out where to place pyreverse outputs and want to have them generated whenever travis will succeed - no commits for this post.
Tools and applications used:
LL (Lessons Learned)
1. Different versions of Pyreverse at Internet.
This is like the first time I actually use pyreverse - I've only heard about it or use it like once couple of years ago.
Now as it turns out there are unmaintained version of pyreverse of 0.5.1 version, and the integrated with pylint version.
There is no such thing like proper documentation in the Internet. There is only man-page documentation and the helper-info from pyreverse command itself.
You may also search for usage of this tool by others.
Read carefully manual page or helper info from
pyreverse --help, ask me (not that I'm experienced with it or something :) ) or search for solution among other developers/technicians.
2. Pyreverse --ignore was a total nightmare.
I've thought I'll use either an absolute path or relative path (but i.e. of pelican : pelican/pelican/tests) - No luck with that.
Finally I've found out HERE, that the path is relative, but starts from where you add source-code to look for (ahh should be more carefull about that ).