The Artima Developer Community
Sponsored Link

Weblogs Forum
I think I am Python Challenged

46 replies on 4 pages. Most recent reply: Aug 24, 2005 8:25 PM by Gregg Wonderly

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 46 replies on 4 pages [ « | 1 2 3 4 | » ]
Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: I think I am Python Challenged Posted: Jun 14, 2005 5:10 PM
Reply to this message Reply
Advertisement
This is a valid point, I understand the frustrations with too much verbosity. These are things that can be resolved. The JCP process is becomming a little more agile and hopefully, individuals will be able to participate more readily as Doug Lea does to make significant things happen.

But why wait a year or two for Java to get a little bit better, when you can use Python today?

Anyway, I think the whole thing is moot. I use Python, Java, C#, JavaScript and C++ regularly. Each has its strength and all have weaknesses.

Gregg Wonderly

Posts: 317
Nickname: greggwon
Registered: Apr, 2003

Re: I think I am Python Challenged Posted: Jun 14, 2005 9:16 PM
Reply to this message Reply
> This is a valid point, I understand the frustrations
> with too much verbosity. These are things that can be
> resolved. The JCP process is becomming a little more agile
> and hopefully, individuals will be able to participate
> more readily as Doug Lea does to make significant things
> happen.

>
> But why wait a year or two for Java to get a little bit
> better, when you can use Python today?

I can, of course, be productive in Java today. I have a set of tools, a set of applications and time invested. Just switching to python is not an overnight thing.

> Anyway, I think the whole thing is moot. I use Python,
> Java, C#, JavaScript and C++ regularly. Each has its
> strength and all have weaknesses.

Well, but how many weaknesses are you content to fight with. Do we need to keep creating the same weaknesses over and over, just hoping that if we try long and hard enough to create something that is more powerful, that somehow it will overshadow all the other issues?

I think we are spending way to much time hunting for fruit in unfertile ground. I don't think that expressivity or simplicity of language constructs is the big payoff.

I think the big payoff is when everything works together seemlessly and we can create Application Oriented Languages as APIs that truely focus the efforts of developers for particular domains/problem spaces.

Thus, I really don't thing we need more languages. We need a platform for programming activity that unifies all the efforts we're extending into the ability to finally work together solving programming problems easily.

I think the .NET program says that microsoft is on this path.

I think the recent activities of Sun talking with dynamic language designers on what might be necessary to make them run in the JVM says that Sun understands the importance of unification and code reuse.

I use the languages that are present on the computer that I am programming on/for. If that's Java, I usually choose it for any keeper code. Throw away stuff, I'll use the UN*X shell tools. So far, I haven't needed perl or python. Part of my reluctance is of course the fact that I don't need another set of tools in another language that I can't use for other applications in other languages.

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: I think I am Python Challenged Posted: Jun 14, 2005 11:06 PM
Reply to this message Reply
I think the expressiveness of the language is of vital importance. I often write something first in Python, even if I intend to write in another language. Because there is so little friction in the language, it allows me to concentrate more on the problem I'm trying to solve. I often find that thinking about how I would do it (or actually doing it) first in Python helps me especially when the real target language is C++; I think this is because my (probably bad) habit in C++ is to think at a lower (less abstract) nuts & bolts coding implementation level, whereas in Python I tend to think at a more about the problem domain.

The problem you are talking about addressing is a big one and both Java and .NET seek to address it, as you've pointed out. It is important and worthwhile, but it is not the only problem in the software domain. However, what I think you are talking about in this case is really the platform, not the language. After all, you can do Python on Java (Jython) and .NET (Python.NET, IronPython).

nes

Posts: 137
Nickname: nn
Registered: Jul, 2004

Re: I think I am Python Challenged Posted: Jun 15, 2005 8:44 AM
Reply to this message Reply
After reading your comments I am starting to think that you are indeed Python Challenged. There are dozen of idioms that are just more convenient in Python. If the extra typing information, casts, checked exceptions, etc. of Java help you to program better then you should be using that. I will just take your word that it does not negatively affect you. Personally I get agravated each time and it reduces my productivity and motivation. Just understand that for some of us Python is just more fun to work with.

Gregg Wonderly

Posts: 317
Nickname: greggwon
Registered: Apr, 2003

Re: I think I am Python Challenged Posted: Jun 15, 2005 11:24 AM
Reply to this message Reply
> After reading your comments I am starting to think that
> you are indeed Python Challenged. There are dozen of
> idioms that are just more convenient in Python. If the
> extra typing information, casts, checked exceptions, etc.
> of Java help you to program better then you should be
> using that. I will just take your word that it does not
> negatively affect you. Personally I get agravated each
> time and it reduces my productivity and motivation. Just
> understand that for some of us Python is just more fun to
> work with.

Believe me, I do understand the motivation of productivity. Where the platforms stand in that regard are the forces to be dealt with.

Your motivation seems to be around code level productivity. I.e. as your typing code, how fast can you get to a solution.

My motivation is at a different level. I worry about how I'll reuse various pieces of code. I worry about how one UI can be integrated into another. I worry about how a particular distributed systems features can be used from another application etc. I worry about network security features. How do I make my network application secure from outside abuse etc.

Interesting views from lots of perspectives.

nes

Posts: 137
Nickname: nn
Registered: Jul, 2004

Re: I think I am Python Challenged Posted: Jun 15, 2005 12:51 PM
Reply to this message Reply
>
> Believe me, I do understand the motivation of
> productivity. Where the platforms stand in that regard
> are the forces to be dealt with.
>
> Your motivation seems to be around code level
> productivity. I.e. as your typing code, how fast can you
> get to a solution.
>
> My motivation is at a different level. I worry about how
> I'll reuse various pieces of code. I worry about how one
> UI can be integrated into another. I worry about how a
> particular distributed systems features can be used from
> another application etc. I worry about network security
> features. How do I make my network application secure
> from outside abuse etc.
>
> Interesting views from lots of perspectives.

Sure once you get at that level of abstraction your application architecture is what matters and the programming language becomes almost irrelevant. Unfortunately I am not seeing that programming is done exclusively at that level unless you are working with similar enough systems all the time that you have something to build on (and you did not sell the rights of your code).

In practice
1.) I end up having to build a lot of the architecture from the ground up
2.) Abstractions leak and I have to go down every so often

So maybe you have figured out your domain space already and have all the libraries, tools, etc in place and I do not, and that is where the difference in perspective comes from.

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: I think I am Python Challenged Posted: Jun 16, 2005 11:29 PM
Reply to this message Reply
> > def qsort(l):
> > if len(l) <= 1:
> > return l
> > return (qsort([x for x in l[1:] if x < l[0]])
> > + l[0:1]
> > + qsort([x for x in l[1:] if x >=
> l[0]]))[/pre]
>
> Collections.sort(...) takes care of sorting things, and
> one can define the appropriate objects/methods to make
> these sorted versions to be usable as R-values.

I don't know how I overlooked this the first time, but I should take the opportunity to concur with you on at least one point, Gregg. I don't know why the qsort example is so popular in the language wars. It would be absolutely inane to write your own qsort in Python -- case in point, the one above is about 15 times slower than Python's built-in sort(). In fact, one of the nice things about Python is you don't have to burn energy figuring out such fundamental thing (of course, this is true of most modern languages/libraries, including Java, C#, etc.).

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: I think I am Python Challenged Posted: Jun 17, 2005 12:38 AM
Reply to this message Reply
> Let's say Python is not quite an order of magnitude more
> productive than COBAL. Let's say it's only 9 times more
> productive. If you think that's identical, then your
> "intents and purposes" are a lot different than mine.
>
> Also, isn't the stuff you mentioned before more sensibly
> done with a spreadsheet than a programming language?

'Productivity' is a very subjective and elusive term, hence my use implication that two processes have to be of an 'order of magnitude' different to be noticeably different. In that context you don't get 0.9 orders of magnitude, you get 'less than an order of magnitude' meaning not much different at all. (In much the same, your ear cannot easily diffentiate between sound volumes of less than an order of magnitude difference in amplitude.)

Given that COBOL is over 45 old and that Python represents the 'cutting egde' of mainstream programming languages, one really does question just how far language design has progressed in that time.

Spreadsheets? Yes, as often as not here; giving someone a predefined spreadsheet with graphs and database links built in does represent the 'simplest thing that works'.

V.

Steve Donovan

Posts: 24
Nickname: stevedonov
Registered: May, 2005

Re: I think I am Python Challenged Posted: Jun 20, 2005 11:59 PM
Reply to this message Reply
This debate seems to assume that there is some unique 'best language' which one would be a fool not to use. Being a multilingual person, I use the best tool for the job. I think we must distinguish between 'informal' and 'formal' programming, since the languages and idioms appropriate for a hundred line utility aren't necessarily going to scale for hundreds of thousands of lines.

That being said, I'm a sucker for conciseness. Here's the same code, in different languages.

       string line;
        ArrayList lines = new ArrayList();
        using (TextReader rdr = File.OpenText("questions.txt"))
            while ((line = rdr.ReadLine()) != null)
                if (line.Length > 0)
                    lines.Add(line);
        string[] questions = new string[lines.Count];
        lines.CopyTo(questions,0);


In C#, compared with the completely equivalent Boo code:


using rdr = File.OpenText("questions.txt"):
questions = array(string,s for s in rdr if s.Length > 0)


Granted, you need to be familar with this list generator idiom, but it is more expressive.

Of course, conciseness can be taken completely too far. A classic is the one-line histogram printer in Python:


>>> arr = [10,30,15,20]
>>> print '\n'.join(['#'*i for i in arr])
##########
##############################
###############
############### #####


Cute, but not very maintainable, extendable, etc.

steve d.

Gregg Wonderly

Posts: 317
Nickname: greggwon
Registered: Apr, 2003

Re: I think I am Python Challenged Posted: Jun 21, 2005 6:38 AM
Reply to this message Reply
> This debate seems to assume that there is some unique
> 'best language' which one would be a fool not to use.
> Being a multilingual person, I use the best tool for the
> e job. I think we must distinguish between 'informal' and
> 'formal' programming, since the languages and idioms
> appropriate for a hundred line utility aren't necessarily
> going to scale for hundreds of thousands of lines.

There are perhaps some indications that some of the comments, mine inparticular, are suggesting that there is a 'best language'. In the end, I am really talking about production application development; i.e. code that is not quickly discarded, or otherwise used in limited application. This type of application, is the driving force behind all the WS-* stuff.

There is an attempt by language and platform system to suggest that inter-application communication, using vendor neutral protocols, is the least common demonator for integration.

I think this is rediculous. The simple existance of multiple application languages has create these problems.

The U.S. govt decided decades ago that a single language was in fact a good idea when they standardized on ADA.

There are lots of good reasons for production code environments to gravitate toward a single language/platform.

The .NET platform sports multiple languages, as does my choice platform, Java. This means that you can integrate at the binary software level, and perhaps even the source level.

The Jini platform's RMI-programming-model based mobile code infrastructure means that distributed systems integration can be at the binary level as well.

This is, in fact, tremendously empowering!

Kay Schluehr

Posts: 302
Nickname: schluehk
Registered: Jan, 2005

Re: I think I am Python Challenged Posted: Jun 21, 2005 11:30 PM
Reply to this message Reply
> There are lots of good reasons for production code
> environments to gravitate toward a single
> language/platform.

Yes, and we all believe in one god only. Amen!

But unfortunately there are not so many successfull projects that support your claim at least not in my experience where huge redesign-efforts that were not carefully wrapping / substituting legacy code but starting on greenfields with Java burned > 100 Mio $ for nothing but hype, ideology and wrong expectations.

> The .NET platform sports multiple languages, as does my
> choice platform, Java.

Do they also support COBOL and PL1 and several machine languages on old IBM mainframes?

> This means that you can integrate
> at the binary software level, and perhaps even the source
> level.

One can also reverse the direction and create translations for several backends. PyPy adopts this approach ( e.g. for CLISP, Java, CPython, LLVM ... ). That's the way a hopefull and usable extension language should work that is able to glue systems together and enable soft migration - not forcing each to run on the same platform with more or less efficient language implementations.

Kay

Steve Donovan

Posts: 24
Nickname: stevedonov
Registered: May, 2005

Re: I think I am Python Challenged Posted: Jun 22, 2005 5:55 AM
Reply to this message Reply
> ... In the end, I am really talking about
> production application development; i.e. code that is not
> quickly discarded, or otherwise used in limited
> application.

Fair enough, although I've dealt with enough legacy FORTRAN to know that sometimes the best solution is to wrap the old solution up and put a nice interface on it, so one's chosen platform can use it.

Having a standard platform is good and reduces wear and tear on the class library remembering parts of the brain. But platforms support multiple languages and are strengthened by that kind of experimentation. Anybody that knows .NET/CLI can pick up IronPython and start doing useful work, even if it isn't 'production code'. For instance, writing tests requires a lot of typing and using a more agile language means that more tests will be written, even if the system in question is done in C# or Java. A person can sit down at an interactive prompt and quickly find corner cases, etc, which make their way into the formal tests.

Gregg Wonderly

Posts: 317
Nickname: greggwon
Registered: Apr, 2003

Re: I think I am Python Challenged Posted: Jun 22, 2005 9:41 AM
Reply to this message Reply
> But unfortunately there are not so many successfull
> projects that support your claim at least not in my
> experience where huge redesign-efforts that were not
> carefully wrapping / substituting legacy code but starting
> on greenfields with Java burned > 100 Mio $ for nothing
> but hype, ideology and wrong expectations.

Is that a fault of the platform, or is it mismanaged projects or incorrect assignment of responsibility? There are lots of factors to consider for the failure of any project.

> > The .NET platform sports multiple languages, as does my
> > choice platform, Java.
>
> Do they also support COBOL and PL1 and several machine
> languages on old IBM mainframes?

It seems that you are talking about maintaining and/or extending an existing application. If you want to move your cobol or pl1 application off of a mainframe, then you probably are going to have to make some changes, no matter what. So, the question becomes is it a better choice to start over, or to continue to feed the fire.

> One can also reverse the direction and create translations
> for several backends. PyPy adopts this approach ( e.g. for
> CLISP, Java, CPython, LLVM ... ). That's the way a
> hopefull and usable extension language should work that is
> able to glue systems together and enable soft migration -
> not forcing each to run on the same platform with more or
> less efficient language implementations.

I think you and I are talking about different levels of development. Extension languages are about automating certain APIs already in a software architecture. That's only part of the problem.

Explain how you take an application running on one machine and then distribute piece parts to multiple machines and then integrate those pieces into a new distributed system. That's the kind of thing that I'm talking about with integration.

It might also be that there are already disparate applications on different machines that need to talk to each other. There are a wide range of choices for how to do it. The question is, which choice provides the most powerful position for growing your new system.

I'm saying that the Java platform (J2SE) is a great way to do this because of its OS neutrality. Java applications running on PowerPC MACs are going to work just as well on Intel MACs. Native code won't.

There are of course additional tools, such as the Jini platform, that provide some great tools for distributed system building.

If you choose to use an extension language to paste your new world together, then you'll have to keep applying glue everywhere to hold it together because a real architecture will be difficult to create within a bunch of adhoc programming structures.

When you put a new wrapper around something, I think there is a lot of value in making the commitment to that being the base of a new SOA/Corporate/Enterprise architecture that will allow new systems to be easily deployed, and fully isolate the legacy environment from view.

This is in essense starting over. However, the initial layer is much cheaper to build than a complete rewrite of the legacy apps. But, it is a very firm foundation with a lot of opportunity to exploit some very powerful features of the Java platform.

I don't want to point any fingers and any particular response, but there is still a lot of feedback in this thread about micro-productivity gains from being able to sit at a prompt and do things. For me, that seems like a complete lack of architecture. I worry that this kind of approach will make sure that an architecture will never really appear.

If you are talking about doing this in some kind of design or investigative phase, then perhaps so. But, I'm not convinced that this is the case. It sure sounds like you want to be able to just sit down and invent a small function to do something and then throw it into the codebase, adhoc.

Kay Schluehr

Posts: 302
Nickname: schluehk
Registered: Jan, 2005

Re: I think I am Python Challenged Posted: Jun 23, 2005 3:46 PM
Reply to this message Reply
> I'm saying that the Java platform (J2SE) is a great way to
> do this because of its OS neutrality. Java applications
> running on PowerPC MACs are going to work just as well on
> Intel MACs. Native code won't.
>
> There are of course additional tools, such as the Jini
> platform, that provide some great tools for distributed
> system building.
>
> If you choose to use an extension language to paste your
> new world together, then you'll have to keep applying glue
> everywhere to hold it together because a real architecture
> will be difficult to create within a bunch of adhoc
> programming structures.
>
> When you put a new wrapper around something, I think there
> is a lot of value in making the commitment to that being
> the base of a new SOA/Corporate/Enterprise architecture
> that will allow new systems to be easily deployed, and
> fully isolate the legacy environment from view.

What you miss to see is that the legacy system is far from being dead and must be extended too because it is the production system. That's why I like an 'embrace it, replace it' approach. Finally it doesn't matter if some financial algorithms in the arithmetic kernel will be calculated using some 20 years old Fortran code if there is some smooth wrapper around it in a high level language. Wrapping existing DLLs using Python and ctypes does not require writing/generating C-API code anymore. For certain tasks abstraction and speed can be considered as completely seperated concerns that may be delegated to Python programmers on the one hand to C/Fortran/Assembly programmers on the other.

I end up seeing not much value in platform neutrality but in splitting the system in two parts where one part is adapting the other is abstracting. Allthough the latter part may be evaluated on a virtual machine that is available for almost all OSes it is not system independent because it interfaces to native code without an additional layer in the middle ( say an XML based one ).


> This is in essense starting over. However, the initial
> layer is much cheaper to build than a complete rewrite of
> the legacy apps. But, it is a very firm foundation with a
> lot of opportunity to exploit some very powerful features
> of the Java platform.
>
> I don't want to point any fingers and any particular
> response, but there is still a lot of feedback in this
> thread about micro-productivity gains from being able to
> sit at a prompt and do things. For me, that seems like a
> complete lack of architecture. I worry that this kind of
> approach will make sure that an architecture will never
> really appear.

Micro-productivity is just easy to demonstrate. An overall micro-productivity helps to clarify ideas and do not obscure them by boiler-plate code. Micro-productivity, a fast interactive feedback, a simplistic syntax and good extension capabilities may be the major issues why Python is popular. At least I think so and try to consider a language as a whole and not just a bunch of features filling a feature matrix.

I think few architectural concerns are situated on the language level. How to decompose a system, which use cases should be applied, what are the guiding metaphors and how can all the different concerns be mapped onto both new and existing tools, machines and processes? The answer to all those questions is surely not building huge class hierarchies and deploying platform independent code.


> If you are talking about doing this in some kind of design
> or investigative phase, then perhaps so. But, I'm not
> convinced that this is the case. It sure sounds like you
> want to be able to just sit down and invent a small
> function to do something and then throw it into the
> codebase, adhoc.

The process model is a very different kind of issue and can be abstracted from the particular languages/tools in use. If programmers working for some company have to deliver a design spec which has to be reviewed and approved before they start coding their behaviour is not optional in this respect. I'm surely aware about the pitfalls of doing 'simply coding' and I'm also not a tool-believer who thinks that a language or a tool chain how great it may be is able to replace human mind. But also no best design process can prevent us from failure in understanding technical matter, doing poor research or creating a large inflexible mess with autodestructive tendencies.

Kay

Gregg Wonderly

Posts: 317
Nickname: greggwon
Registered: Apr, 2003

Re: I think I am Python Challenged Posted: Jun 23, 2005 7:56 PM
Reply to this message Reply
> What you miss to see is that the legacy system is far from
> being dead and must be extended too because it is the
> production system. That's why I like an 'embrace it,
> replace it' approach. Finally it doesn't matter if some
> financial algorithms in the arithmetic kernel will be
> calculated using some 20 years old Fortran code if there
> is some smooth wrapper around it in a high level language.
> Wrapping existing DLLs using Python and ctypes does not
> require writing/generating C-API code anymore. For certain
> tasks abstraction and speed can be considered as
> completely seperated concerns that may be delegated to
> Python programmers on the one hand to C/Fortran/Assembly
> programmers on the other.

I'm not trying to say that the legacy app is not changing. I'm only suggesting that adopting a pattern of layering to replace may provide a better path then extend in place. Whether your using python or Java for this, you'll probably be able to do all the simple things. The question is whether python will provide anything different then Java from a language function perspective. I think not. The Java platform encompasses a lot more powerful tools for enterprise level applications, and in particular distributed computing.

> I end up seeing not much value in platform neutrality

Then you are not doing much beside working with the same applications and hardware, layering stuff in place.

Platform neutrality and the lack thereof is what is keeping those mainframe applications running on outdated hardware!

> but
> in splitting the system in two parts where one part is
> adapting the other is abstracting.

This is where Jini excels. You can use it as a front end to place a new network centric (the network is the computer) view of your computing environment. This is the integration point!

> Allthough the latter
> part may be evaluated on a virtual machine that is
> available for almost all OSes it is not system independent
> because it interfaces to native code without an additional
> layer in the middle ( say an XML based one ).

I'm afraid I don't understand? The Java platform consists of a set of APIs. The implementation of those APIs has to meet the specs. It may or may not happen from interfacing with native code. The aJile line of processors execute Java bytecode natively at up to 100mhz. There is no JNI or native layer there. Yet, the J2ME CLDC code that I run on my cellphone will run on that processor just as well.

I don't to see how XML fits into this. Can you clarify?

> Micro-productivity is just easy to demonstrate. An overall
> micro-productivity helps to clarify ideas and do not
> obscure them by boiler-plate code. Micro-productivity, a
> fast interactive feedback, a simplistic syntax and good
> extension capabilities may be the major issues why Python
> is popular. At least I think so and try to consider a
> language as a whole and not just a bunch of features
> filling a feature matrix.

Well, this is the question. Are all the minutes you are saving in testing code saving you time/money in how much work you have to do to really create the solution now, and will it work in the future for the other needs you might have?

> I think few architectural concerns are situated on the
> language level. How to decompose a system, which use cases
> should be applied, what are the guiding metaphors and how
> can all the different concerns be mapped onto both new and
> existing tools, machines and processes? The answer to all
> those questions is surely not building huge class
> hierarchies and deploying platform independent code.

I sense some sort of focus on the classic image of J2EE applications. Large collections of boiler plate code lumped into large containers of multi layered class hierarchies.

That is not Java! That is only an attribute of one of the more unfortunate directions that the industry decided to take. There are perhaps 10,000 to 100,000 people that can take advantage of J2EE tools. There are more than a 1,000,000,000 that can take advantage of J2SE desktop apps.
Somehow the market is being missed...

The majority of my Java applications use the Jini tools and are comprised of a handful of classes.

> The process model is a very different kind of issue and
> can be abstracted from the particular languages/tools in
> use.

I think that there are particular programming moments and particular design moments that each software platform requires. In the past, everyone wanted to use the waterfall model because we had languages and applications which had hugely complicated interactions with the world they ran in. Dynamic languages and languages such as Java that provide runtime checks are much easier to create software from a design in realtime with. These languages can benefit from a less rigorous model and I think its important for to make note of that and learn how to improve your productivity by executing the steps that add value.

> If programmers working for some company have to
> deliver a design spec which has to be reviewed and
> approved before they start coding their behaviour is not
> optional in this respect. I'm surely aware about the
> pitfalls of doing 'simply coding' and I'm also not a
> tool-believer who thinks that a language or a tool chain
> how great it may be is able to replace human mind. But
> also no best design process can prevent us from failure in
> understanding technical matter, doing poor research or
> creating a large inflexible mess with autodestructive
> tendencies.

Okay, we're on the same page here regarding tools not creating designs. But, I still contend that choosing the right tools, including language/platform can add value to the system you are building.

Flat View: This topic has 46 replies on 4 pages [ « | 1  2  3  4 | » ]
Topic: The Final Performance Testing Example Previous Topic   Next Topic Topic: Punchy Design

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use