Registered: Sep, 2005
Re: Programming with "Duh" Typing
Posted: Jul 16, 2007 9:06 AM
> > > BTW it is the language semantics that motivates the
> > > "typing faster" meme i.e. getting code that is
> > > requires less boilerplate and is more on the spot.
> > > not about how long it takes to select a method or
> > rename
> > > instances. These are trivial efforts and nice to have
> > at
> > > best.
> > But these are just straw men. Renaming a method is
> > the most trivial of things that can be automated using
> > information in a static language.
> I guess all implementation difficulties with standard
> refactoring pattern can be put on the ground of alpha
> conversions. Counterexamples are welcome.
Sorry, I'm not following you. Could you point me to a definition of 'alpha conversion'?
> But Python is just halfway in reach of M.Fowlers book. So
> do we call in the end for more constrained languages that
> cripple our design for our own wealth or do we call for
> more advanced analysis techniques for whatever program in
> dynamically typed languages?
Can you explain why static typing necessarily cripples a design?
> It would be helpfull to make feelings more precise. Not so
> much for winning an argument but for those of us who
> undertake language level analysis and try to learn from
> user experiences - turning them into use cases.
I think you are asking me to be more specific so I'll try to give a better idea with what I am dealing with. The company I work for has been using a gui tool to do a lot of development "without code". Now, something needs to change in the data model and we need to understand how a certain piece of data is used and where it is being replicated and how that is used and being replicated...
The tool doesn't provide this kind of 'explosion' search functionality and as the usage branches out, it becomes too time consuming to use what search capabilities it does provide. In other words, it's time to pay the piper.
The processes defined in this tool can be exported to XML and I am using XPath to recursively search through this data for references. Unfortunately, it's not really feasible to export everything into a single document and there are pieces of logic required to interpret the document that are hard (for me at least) to specify in Xquery or XPath.
So I am using Python (Jython) to build the logic and calling XPath to find the elements. The idea here is to be as quick as possible because this development is not officially sanctioned but I know this is common issue and I want to be able to reuse as much as possible.
The benefits of Python for this work are immediately obvious: overriding  for attributes simplifies the code greatly, factory constructors move a lot of boilerplate to more basic parts of the code. For comprehensions and generators made things a lot quicker.
I was able to get some basic recursive searches done. But as I go down the rabbit hole, I'm finding more non-uniform aspects of the xml and how it is structured. Unfortunately there is no documentation and I'm having to discover the design as I go. A lot of this boils down to trial and error. When I hit a new type of element that I have not accounted for, I need to add that logic.
The problems I have had are: as I make changes, I often don't realize that I have made some trivial error until 5 minutes into the test, when that code is first hit. This is slow. Most of the time these are things that would have been immediately flagged in a static language. When I want to add a new type or logic for a new scenario, it takes me a good bit of recollection to figure out where things fit together; how I get from point A to point B. Often I get halfway through a change and I realize that the change is not compatible with something else that I have already done. Along with finding what needs to be changed, returning it to a previous state is basically ad-hoc. This might be relieved by a good IDE. I find myself staring at the screen trying to figure out a way to change things without having to take a full inventory of my work so far. I kind of feel like I'm driving a car with no reverse gear.
One of the things I miss but isn't a huge deal is being able to type a couple letters of a method name and select the correct method and have the IDE show me the arguments, their types and the documentation for the method. This also may be available in a Python IDE. I find that in some ways I'm doing more typing in Python than I do with Java.