Hi!
Out of curiosity, how do I draw functions outside classes with UML? How
module could be drawn in this case?
More theoretical question is if I create classes on the fly, how UML can
reflect that?
(I know that Python code itself is best at communication design ideas,
but there are some people which prefer to talk UML.)
(Have not found anything relevant with google)
Thanks!
Regards,
Roman Suzi 16 5358
>> Out of curiosity, how do I draw functions outside classes with UML? How
module could be drawn in this case?
As a utility class. More theoretical question is if I create classes on the fly, how UML can
reflect that?
"On the fly" usually means "at runtime". I guess you mean if you
"change code" will my diagram stay in sync?. You will have to use round
trip tools. I don't know any tool supports round trip for Python code.
But if you just mean reverse engineering, lookup PyNSource, Boa
Constructor, PyReverse among others
(I know that Python code itself is best at communication design ideas,
but there are some people which prefer to talk UML.)
Actually no. Python is a good tool for "prototypin g" which is not the
same as "communicat ing design ideas". Diagrams are better for the later
and do not need to be executable. At least from what I know, except
Eiffel, no language makes that claim. UML is really the only contender
currently for design notation.
Roman Susi wrote: Hi!
Out of curiosity, how do I draw functions outside classes with UML? How module could be drawn in this case?
I would say that within a class diagram, you can't. In other UML
diagrams (such as sequence interaction), the function is simply used as
if it were a method belonging to an object. If you need to make it
clear where this function is located within the code, use a note on the
diagram.
Remember, UML is not able to accurately capture all implementation
details of a system; It's not meant to. More theoretical question is if I create classes on the fly, how UML can reflect that?
Again, don't try to depict fine-grained implementation details. If the
dynamically generated class is important to the class diagram, include
it but don't include all of it's internals (methods etc.). Use a note
to exaplin how/when/why it is generated. (I know that Python code itself is best at communication design ideas, but there are some people which prefer to talk UML.)
(Have not found anything relevant with google)
Thanks!
Regards, Roman Suzi
Rob C
Roman Susi wrote: Hi!
Out of curiosity, how do I draw functions outside classes with UML? How module could be drawn in this case?
I'm not up to par on the latest UML specs (or not too old) - but I don't
believe UML handles that: it is called a class diagram after all.
More theoretical question is if I create classes on the fly, how UML can reflect that?
You mean objects I think: by using a 0..n in you agregation ? (I know that Python code itself is best at communication design ideas, but there are some people which prefer to talk UML.)
(Have not found anything relevant with google)
Thanks!
Regards, Roman Suzi
Regards,
Philippe
Ravi Teja wrote:
(snip) More theoretical question is if I create classes on the fly, how UML can
reflect that?
"On the fly" usually means "at runtime". I guess you mean if you "change code" will my diagram stay in sync?.
Nope, the OP really meant "on the fly", as in "at runtime". In python,
it is possible to create new classes at runtime. Remember,
everything-is-an-object implies that classes are objects too.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom. gro'.split('@')])"
Philippe Martin wrote: Roman Susi wrote:
(snip) More theoretical question is if I create classes on the fly, how UML can reflect that?
You mean objects I think:
Yes : class objects !-)
Python's classes *are* objects. And you can create new classes at runtime.
(snip)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom. gro'.split('@')])"
Ravi Teja wrote: Out of curiosity, how do I draw functions outside classes with UML? How module could be drawn in this case?
As a utility class.
So, function could be a utility class method. If there are no better ways. More theoretical question is if I create classes on the fly, how UML can reflect that?
"On the fly" usually means "at runtime". I guess you mean if you "change code" will my diagram stay in sync?. You will have to use round trip tools. I don't know any tool supports round trip for Python code. But if you just mean reverse engineering, lookup PyNSource, Boa Constructor, PyReverse among others
No. I do not need it. I just want to know if UML is capable of doing it.
(I know that Python code itself is best at communication design ideas,
but there are some people which prefer to talk UML.)
Actually no. Python is a good tool for "prototypin g" which is not the same as "communicat ing design ideas". Diagrams are better for the later and do not need to be executable. At least from what I know, except Eiffel, no language makes that claim. UML is really the only contender currently for design notation.
Well, maybe SOL (Semantic Object Language) could also be quite
beneficial in some cases. At least, it depends with whom to communicate
design ideas and what level of formality to maintain.
Also, my argument that Python is quite good at communicating design
ideas is supported by the fact that Python developers do not use UML (or
other modelling tools/languages) as often as say Java programmers, nor
feel the need to. And probably Python is too dynamic for UML. That is
another reason rountrip tools aren't there.
--
Roman
But not in UML: a class diagram will represent classes while a sequence
diagram objects.
Philippe
bruno at modulix wrote: Philippe Martin wrote: Roman Susi wrote: (snip)
More theoretical question is if I create classes on the fly, how UML can reflect that?
You mean objects I think:
Yes : class objects !-)
Python's classes *are* objects. And you can create new classes at runtime.
(snip)
> So, function could be a utility class method. If there are no better ways.
What I mean is <<utility>> is the formal notation for a class in which
global functions are aggregated. It's not a hack.
Python is not alone here. Most OO languages aside Java and Smalltalk
have functions outside classes and UML accomodates though not
encourages free functions. Well, maybe SOL (Semantic Object Language) could also be quite
beneficial in some cases. At least, it depends with whom to communicate
design ideas and what level of formality to maintain.
I don't know what Semantic Object Language is. One important
requirement of choosing communication notations is that they should be
sufficiently popular that everyone understands. Kind of beats the
purpose if you are the only person who knows it. I got 146 hits on
Google for "Semantic Object Language" and UML. Too few for me to care.
If it is a deserving notation, hopefully that will change in the
future.
Also, my argument that Python is quite good at communicating design
ideas is supported by the fact that Python developers do not use UML
(or
other modelling tools/languages) as often as say Java programmers, nor
feel the need to.
I guess you and I mean VERY different things when we say "Design
Ideas". You seem to imply pseudo code. I mean overall archetecture. I
think Python devs will use UML tools if there are good ones available.
I know I would. I could really use a round trip class and package
diagram editor now.
And probably Python is too dynamic for UML. That is another reason rountrip tools aren't there.
As you probably already know, UML diagrams are structural and
behavioural (plus interactional with 2.0). Round trip tools only model
structural diagrams. Python is dynamic but only once the program starts
executing :-). Even though Python classes "can" change, they do so only
at runtime ( wouldn't it be scary if they decided to change as code
when you are not looking :-) ). So dynamism of Python should not be as
much of an issue. I think the reason we don't have good UML round trip
tools for Python is primarily a market issue rather than a language
issue. If Python gets the same market share as Java, it will surely get
all these tools and more.
In <ma************ *************** ************@py thon.org>, Roman Susi
wrote: Out of curiosity, how do I draw functions outside classes with UML? How module could be drawn in this case?
I just create a (UML) class for modules. After all a Python module can be
seen as a class definition for a singleton which is instantiated at import
time.
Ciao,
Marc 'BlackJack' Rintsch This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sandeep Gupta |
last post by:
Hi,
I've written a commercial application that uses Python scripts for
some of the functionality. Installing the Python portion of the
application requires me to first install Python, and then install the
scripts. I'm looking for an easier way to install the Python portion.
I've been referred to: http://www.mcmillan-inc.com/install1.html
Which application would people recommend for creating a standalone
|
by: Dan Williams |
last post by:
Hi people
I'm getting a little annoyed with the way the print function always adds a
space character between print statements unless there has been a new line.
The manual mentions that "In some cases it may be functional to write an
empty string to standard output for this reason." Am I the only the who
thinks that this sucks? It's the first thing I've come across in Python that
I really think is a design flaw.
Is there a good way to...
|
by: j_mckitrick |
last post by:
Does it make sense to use doc strings rather than #-comments for a
standalone Python app? If the classes aren't going to be re-used or
imported, do they need them?
|
by: Chris |
last post by:
hello,
I have a small module which only contains some utility functions. when
running this standalone I would like to show the module docs and each
function docs, as if doing
import M
help(M)
I came up with the following but I reckon there is a much simpler way?
|
by: James Stroud |
last post by:
Hello All,
I am trying to create a semi-standalone with the vendor python on OS X
10.4 (python 2.3.5). I tried to include some packages with both
--packages from the command and the 'packages' option in setup.py. While
the packages were nicely included in the application bundle in both
cases (at Contents/Resources/lib/python2.3/), they were not found by
python when the program was launched, giving the error:
"ImportError: No module...
| |
by: beginner |
last post by:
Hi Everyone,
I am looking for a way to allow a standalone python process to easily
interactive with a few web pages. It has to be able to easily receive
requests from the web and post data to the web.
I am thinking about implementing a standalone soap server, but I am
not sure which library is good.
Any suggestions?
|
by: shaun roe |
last post by:
This may be a question of style:
Sometimes I need a little helper function (e.g. checkRange(val, lo, hi))
in my .cpp and have a habit of making these functions simple standalone
functions in the .cpp file instead of member functions, because they
don't access any member variables. My understanding is that the 'static'
keyword in this context restricts their scope to the .cpp file.
If I find I use the function a lot, I promote it to a fully...
|
by: Gabriel Rossetti |
last post by:
Hello everyone,
I like to create a cross-platform standalone python application, like
Mac OS *.app dirs. The idea is to distribute a zip file containing
everything (the python interpreter and all) so that a user just unzips
it and runs it. Has anyone ever done anything like that? I searched
google but didn't find anything really, and currently, even in my dev
env, I have to set the PYTHONPATH manually, and for a standalone app I...
|
by: Philip Semanchuk |
last post by:
On Oct 17, 2008, at 2:59 AM, Gabriel Rossetti wrote:
Hi Gabriel,
For details on how OS X .app dirs work, plug this into Google:
"os x" application bundle
But as Martin said, that's specific to OS X and won't port to other
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |