pain

M

Mage

Hello,

I started to learn python some months ago. Mostly for fun, but I
replaced php to python in many tools at my company in the last weeks.

Because of our boss decision now I have to learn java. I can tell java
is one of the worst things including WW2. Even after seeing the light I
may vomit when I write java code.

Look at this tutorial from java.com:

public class BasicsDemo {
public static void main(String[] args) {
int sum = 0;
for (int current = 1; current <= 10; current++) {
sum += current;
}
System.out.println("Sum = " + sum);
}
}

It is "print sum(range(11))" in python.

I just had to tell this, sorry for the bandwith. I suggest you to feel
lucky if you may use python at your work.

Mage
 
M

Michael Hoffman

Mage said:
Look at this tutorial from java.com:

public class BasicsDemo {
public static void main(String[] args) {
int sum = 0;
for (int current = 1; current <= 10; current++) {
sum += current;
}
System.out.println("Sum = " + sum);
}
}

And then you have to compile it and set up your classpath...
It is "print sum(range(11))" in python.

I would have used print sum(xrange(11)) myself. This probably has almost
zero measurable performance impact, but I think using xrange() instead
of range() is usually a good habit. As you know, xrange() generates ints
as it is called rather than all at once, which can be quite helpful with
large ranges.
> I suggest you to feel lucky if you may use python at your work.

Every day.
 
M

Mandus

Wed, 03 Aug 2005 17:45:34 +0200 skrev Mage:
Hello,

I started to learn python some months ago. Mostly for fun, but I
replaced php to python in many tools at my company in the last weeks.

Because of our boss decision now I have to learn java. I can tell java
[snip]

maybe you can use jython, and tell your boss it's Java. A boss forcing
people to learn and use Java probably have no interest at all ever read
the code himself, so you will probably get away with it. I mean, a
clueless boss...

or just find another place to work?

Don't code Java, be happy :)

mvh,
 
M

Mage

Mandus said:
Wed, 03 Aug 2005 17:45:34 +0200 skrev Mage:

Hello,

I started to learn python some months ago. Mostly for fun, but I
replaced php to python in many tools at my company in the last weeks.

Because of our boss decision now I have to learn java. I can tell java
[snip]

maybe you can use jython, and tell your boss it's Java. A boss forcing
people to learn and use Java probably have no interest at all ever read
the code himself, so you will probably get away with it. I mean, a
clueless boss...
Thank you, I will check this out. My company will switch to a jsp site.
Isn't jython slower (I mean performance) than java? As well as I
understand jython code will be interpreted twice.
or just find another place to work?
Acceptable but I have some reasons to stay.
Don't code Java, be happy :)
I would be surprised if there were more than five python jobs in my
country but have to look around.

Mage
 
M

Mage

Michael said:
I would have used print sum(xrange(11)) myself.
This is why I love python and this list.
I can't be as offtopic that you wouldn't be able to say something useful
to me about python. Thank you.

Mage
 
G

Grant Edwards

Isn't jython slower (I mean performance) than java? As well as
I understand jython code will be interpreted twice.

Jython gets compiled into Java byte code just like Java gets
compiled into Java byte code. Then whatever platform you're
using either interprets the Java byte code or uses some variant
of JIT compilation into native object code.
 
T

Terry Reedy

Mage said:
Thank you, I will check this out. My company will switch to a jsp site.
Isn't jython slower (I mean performance) than java? As well as I
understand jython code will be interpreted twice.

I believe only in the sense that Java is interpreted twice: once to compile
to Java bytecode and again, as often as you want, to run the bytecode
(assuming that it is kept around, just as .pyc files are).

tjr
 
M

Mage

Terry said:
I believe only in the sense that Java is interpreted twice: once to compile
to Java bytecode and again, as often as you want, to run the bytecode
(assuming that it is kept around, just as .pyc files are).
Thank you, I will read it thoroughly instead of just fast-reading the
mainpage as last time :)

Mage
 
M

Martin P. Hellwig

Mage wrote:
Thank you, I will check this out. My company will switch to a jsp site.
<cut>
Well I don't know your company and how many developers there are but I
know this; a manager telling me what tools to use to do my job is a bad
manager by definition because he should realize that the people who best
know what tools to use are the peope who use the tools*. If by any
chance a manager believes that his employees aren't qualified to make
that decision for them self then he hired the wrong people, which makes
him bad manager too.

But perhaps there are other compelling reasons to switch to a jsp site,
but since this is webbased, there are *tons* of ways to mix your
favourite language with it, even as abstracted as having a jsp (proxy)
page do nothing more then fetch its page from a python powered internal
webserver.

--
mph


* Did you know that most good chef cooks have their own knive set?
And what do you think is the reason a restaurant manager don't tell them
to use the company in-house Amefa blades instead of his global knives?
 
G

Greg Lindstrom

Mage Wrote:
I would be surprised if there were more than five python jobs in my
country but have to look around.

I Reply:
It's not quite that bad in Arkansas (USA), but when I was hired to help
start a new IT department I insisted on using Python and my employer
agreed to try it. I now have over 15,000 lines of code running in
production and the CEO of the company says he has "six or seven" more
projects for me to write (with huge cost saving potential for the
company). We're running on GenToo Linux using a Postgres database and
PHP for our web development. We've automated about 25% of our day to
day business and are looking to expand! I've never had more fun
writing code, and I've been writing code for over 20 years.

Would it be possible to talk to your supervisor and convince them to
allow you to use Python? Start small, with a little project. When you
show them that Python "works" and that they will be able to understand
the code, I'm guessing they will let you do more. Before you know it,
you're coding everything in Python.

Best of luck,
--greg
 
P

projecktzero

"a manager telling me what tools to use to do my job is a bad
manager by definition because he should realize that the people who
best
know what tools to use are the peope who use the tools*."

I'm sorry, this doesn't make much sense to me. In an ideal world where
all developers are all knowing and know every language inside and out,
then allowing each developer to choose his tools(languages) would work.
You don't see a problem with programmer Joe using Perl, Brad using
Python, Carl uses Smalltalk, Nate uses Java, Steve using Ruby, and Ed
using Haskell?

"* Did you know that most good chef cooks have their own knive set?
And what do you think is the reason a restaurant manager don't tell
them
to use the company in-house Amefa blades instead of his global knives?
"

This is a very poor analogy. The next chef doesn't have to re-cook what
the previous chef has done(well, that didn't work either)...er...This
has nothing to do with programming.

The manager may have his reasons for choosing the tools. Perhaps nearly
all projects that have been developed and are in development are using
paticular tools. It's easy for team members to work on any project.(I'm
speaking more of languages and frameworks not down to the editors and
IDEs.) It would be nice if the team could decide on tools, and
sometimes that's appropriate. Maybe they want to migrate to a new
language or framework. Maybe there's a throw away project that could be
a test for the new language or framework. If you want to try a
new/different language, you need to show the benefit other than "it's
cool/new".
 
M

Mike Meyer

Grant Edwards said:
Jython gets compiled into Java byte code just like Java gets
compiled into Java byte code. Then whatever platform you're
using either interprets the Java byte code or uses some variant
of JIT compilation into native object code.

The compiled jython will pay a performance penalty for being
dynamic. Where Java knows the type of objects, and can deduce the
correct method to call at compile time (well, some of the time,
anyway), the jython code will have to do a method search at run time.

Chance are, if you're supposed to be wwriting in Java, your
application isn't sensitive enough to the performance of the code for
this to matter.

<mike
 
K

Kent Johnson

Mike said:
The compiled jython will pay a performance penalty for being
dynamic. Where Java knows the type of objects, and can deduce the
correct method to call at compile time (well, some of the time,
anyway), the jython code will have to do a method search at run time.

Yes, the compiled code makes heavy use of the Jython runtime to get anything done.

*But* most of the hard work will probably be done by Java code in libraries you call. For example a Swing UI, XML parsing, database calls, etc all will happen in Java code. So in practice the performance penalty is not significant and is more than offset by the productivity benefit.

Kent
 
M

Mike Meyer

Kent Johnson said:
Yes, the compiled code makes heavy use of the Jython runtime to get anything done.

*But* most of the hard work will probably be done by Java code in
libraries you call. For example a Swing UI, XML parsing, database
calls, etc all will happen in Java code.

One would hope so. That's how you get good performance out of CPython
apps - you arrange for the heavy lifting to be done by libraries
written in C.

<mike
 
J

James Stroud

"a manager telling me what tools to use to do my job is a bad
manager by definition because he should realize that the people who
best
know what tools to use are the peope who use the tools*."

I'm sorry, this doesn't make much sense to me. In an ideal world where
all developers are all knowing and know every language inside and out,
then allowing each developer to choose his tools(languages) would work.
You don't see a problem with programmer Joe using Perl, Brad using
Python, Carl uses Smalltalk, Nate uses Java, Steve using Ruby, and Ed
using Haskell?

A library could be written in python and interfaced in java for others to use
who are too lazy to know both.
"* Did you know that most good chef cooks have their own knive set?
And what do you think is the reason a restaurant manager don't tell
them
to use the company in-house Amefa blades instead of his global knives?
"

This is a very poor analogy. The next chef doesn't have to re-cook what
the previous chef has done(well, that didn't work either)...er...This
has nothing to do with programming.

The manager may have his reasons for choosing the tools.

Reason: ignorance.
Perhaps nearly
all projects that have been developed and are in development are using
paticular tools. It's easy for team members to work on any project.(I'm
speaking more of languages and frameworks not down to the editors and
IDEs.) It would be nice if the team could decide on tools, and
sometimes that's appropriate. Maybe they want to migrate to a new
language or framework. Maybe there's a throw away project that could be
a test for the new language or framework. If you want to try a
new/different language, you need to show the benefit other than "it's
cool/new".

A manager insisting on java is probably only thinking about name recognition
anyway. Hey Mr. Client, were using java. Isn't that "cool"?



--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
 
S

Steve Holden

James said:
Reason: ignorance.
[...]

and the day managers stop being ignorant we'll all be able to fly around
on pigs. Not wishing to offend the pigs, of course.

still-working-for-myself-ly y'rs - steve
 
P

Peter Hansen

Steve said:
and the day managers stop being ignorant we'll all be able to fly around
on pigs. Not wishing to offend the pigs, of course.

still-working-for-myself-ly y'rs - steve

What Steve means here, of course, is that he is his own manager.

;-)

-Peter
 
S

Steve Holden

Peter said:
What Steve means here, of course, is that he is his own manager.

;-)
Right. This means I get to make fun of my own pointy hair.

at-least-as-long-as-i-still-have-hair-ly y'rs -steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top