[Tutor] Trying to find a value in a function.

D2 borelan@wanadoo.fr
Fri Mar 14 11:39:10 2003


Magnus Lycka a écrit:

> Could you please show us a simple example of such a text file,
> and tell us what you want to happen with it. I think I need
> something very concrete here...

The text file only contains properties of the instance to be created and 
is exported from a database.

Let's take an example

In our program,
the class
user:
  name
  adress
  job
  homedir

the constructor (addaUser) will :
create an instance,
create the home directory,
update the company's tree,
update the company's directory,
update the payroll
verify the email,
  notify the sysadmin in case of failure or
  notify the users of the creation of their homedir,
notify the financial services
etc...

The constructor not only creates instances of the product.

Provided by the customer, a user file containing name, adress, job, 
department, home directory, email, which structure may be different for 
each customer.

Bob, 15 parkway, CEO, Headquarters, bobdir, bob@thecorp.com
Jim, Washington, CTO, Technical division, jimdir, jim@thecorp.com

or

Bob    15 ParkWay   CEO  Headquarters          bobdir   bob@thecorp.com
Jim    Washington   CTO  Technical division    jimdir   jim@thecorp.com

or

Bob
bobdir, bob@thecorp.com
15 ParkWay
CEO, Headquarters

The application will be used by non-programers.
To update it, they'll import the data by choosing the ImportStructure of 
what they are importing, describing their FormatStructure in a form,
	(in the last example the format will be :
	 multiple lines record
	 field separator in a line : ','
  	4 lines per record (there may be a record separator)

and associate the object properties to their files via a form.
	instance.name		= field1
	instance.adress		= field4
	instance.job		= field5
         instance.department	= field6
	instance.homedir	= field2
	instance.email		= field3

My application will use the FormatStructure to identify each field and 
the user will associate the fields to the instance via the 
RelationshipStructure.

Notice that the application will be used by different companies, that we 
won't know the structure of their files.
We will provide a clear description of the object in a form for them 
being able to update their application without external assistance.

 > I also have a feeling that python dictionaries might be part
 > of the solution to your problems...

I use dictionaries to associate defaults values to their arguments or 
labels to arguments names or imported fields to arguments and so on.


What i want too, is to use this application to provide an evolutive 
documentation on fonctions and classes used in an application at the 
property level (what is the property, where it is coming from, how it is 
  involved in the application, in what other functions it is used, etc.) 
updated by programers and technical users.
For example i'm trying to understand a python application, i'll be happy 
to have a structured description of the application and to store my 
understanding of every element of the application via a form.

I don't think it's so complicated and there may be simpler ways to do 
that (perhaps provided by python functions) so i'd follow the tracks 
you'd indicate to me.
I wanted to know how deep i'd be able to automate the analysis of a 
function.

Notice that my last programing experience occured 20 years ago and that 
i learnt the name of python 4 months ago.
I knew that OOP existed. :)
That may explain that, to me, a hill may look like the Everest.

Andre.