Re: Java versus Python

  • From: "black ares" <matematicianu2003@xxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 19 Jun 2011 10:37:00 +0300

first of all the article is the worst I ever seen.
That plugin framework will work only if you will work on that project.
If other persons are involved, every one should know in deep about the code because they have no other way to see how to work with that plugin system.
More over, the example with c++ you give, is not realistic.
Just for the reason you use a language provided function like sum is not a big deal because that sum function behind does what the c++ snipet shown by you does. So if you implement in c++ a sum function iterating over a collection of objects and adding them returning the result in the finish.
You can write the same thing in c++ in the same amount of code.
So the only proof you've done is that may be the python language offers more functions to use so it is, some what, richer in features.

Getting back to the "duck typing" imagine that the entire java framework or dotnet framework had been written using duck typing. How you will use them? You will read all that code to see what the hell a class is doing? Even with properly named classes and functions with out documentation you can not use it corectly. More over if at every step you wana use something you stay and read the documentation and the code to see how to go further, this seems to me a loose in productivity not a gain. By using an interface I simply see what are the methods expected and use them. I don't care about the behind code and sometimes I don't have access to it.

----- Original Message ----- From: "Q" <q@xxxxxxxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, June 18, 2011 10:54 PM
Subject: Re: Java versus Python


Sina,
Python applications are inherently extensible, see this recipe for a trivial-to-implement plugin framework:
http://martyalchin.com/2008/jan/10/simple-plugin-framework/
Admittedly, my experience on large teams is limited. Working on Qwitter I've had around 7 other people in total contribute anything approximating a significant amount of code. While I've seen people have plenty of conceptual issues, trying to use a number in place of a string was hardly a prevalent one... I personally have recently been porting a 10kLoC c++ codebase to python. During the experience, the thing which most-often strikes me is the amount of code I'm saving. Consider the following snippet:
c++:
double totalFuel = 0;
foreach(HSSystemInstance*, tankSys, mShip->FindSystemsByType(HSST_FUELTANK)) {
    HSFuelTankInstance *tank = static_cast<HSFuelTankInstance*>(tankSys);
    if (tank->GetFuelType() == GetFuelType()) {
      totalFuel += tank->GetCurrentFuel();
    }
  }
  Python:
total_fuel = sum([tank.current_fuel for tank in self.ship.find_systems_by_type(systems.FuelTank) if tank.fuel_type == self.fuel_type])
While I realize
this departs a bit from the original topic of the thread--the original comparison being to Java, I hope this illustrates a bit of the absurdity inherent in statically-typed languages without type inference. On the question of "Does it scale?", let us consider the Django web framework, a collaborative effort of over 65,000 lines (and before you old-timers comment as to the relative smallness of 65kLoC, consider the compression ratio I demonstrated python affords us above.) Anyway, there's little chance I'll be ending this age-old debate which is hardly-unique to the blind community with this message, but I did feel it necessary to correct yet more FUD tossed around about what is admittedly my favorite high-level language.
     Q

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: