tags:

views:

1142

answers:

13

My team is faced with change. We develop on Unix, on backend servers. We do no GUI development. We are the business logic between another team's Java front end (XML interface) and the database. Currently our codebase is large, and it's all in C. We are held back by having to work with a very primitive ancient home-made non-relational non-distributed database with a very primitive C-only library (we inherited it from the previous wave of programmers 12 years ago). We have to do a major rewrite of everything to get away from this database and on to Postgresql. With such a major rewrite coming, it has been decided that we may as well change language at the same time because it would make the conversion simpler than doing it in C. We are enthusiastic about this, career-wise. We want to move to unit testing, frameworks, rapid development, as long as we maintain our accuracy and minimal bug count.

However, there is another team in our company, led by one developer who is an enthusiastic Java developer. He has strong influence over our manager. He wants us to move to Java for his own reasons, mainly so we can do some of his work, something we wish to avoid at all costs because his work is an abomination. One of our most important elements in choosing a language to switch to, is to maintain our independence and not become part of the Java pusher's world.

The database conversion has started, in that we now mirror the home-grown database into Postgresql, and the two are in sync and stay in sync. We are careful to proceed in stages, so it's not a big-bang conversion. Now we can start converting individual processes to pull from Postgresql instead of the home-grown database. We will start with the smaller and simpler processes, convert them, get the conversion experience, develop our libraries, and then slowly tackle the more complex processes. The temptation is to just do it in Python and not tell them until we are too far down the conversion process.

By now, our manager is aware that there are two desires in the department - Java and Python. Our manager is technical, up to a point, but he is strongly influenced by the Java developer. We must gather our arguments and present them and argue our case. We have no actual Java experience, but we have some Python experience and are gaining more rapidly in our own time. We have examined Java and think that it is wordy and similar to C in many ways and will not help us do the rewrite quickly and will not help us with future rapid development. We have begun working in Python and love the simplicity, the terseness, the rapid development. We believe we could maintain our accuracy and achieve rapid development by moving to Python.

So, in the interests of our careers, should we give in and do it in Java, or should we push ahead and argue for Python? What would be best for the business, and what would be best for us?

I wanted to know what the community thought.

[Edited to include more of the circumstances.] [And edited some more]

[Thanks for all the replies, folks, you've given me lots to think about, and you've been a great help.]

+2  A: 

You have to understand where they're coming from. Java developers are around a lot more. What you have to do is convince them that they'll get higher quality programmers by looking for Python guys. You should also show them examples of how clean and maintainable Python is.

Also, to seem honest, mention one of Python's shortcomings and talk about how you can combat it (duck typing [arguably, folks] can be overcome with extensive unit testing) and one of the issues with Java (verbosity) and how it's un-combatable.

Alex Gartrell
why do they get "higher quality programmers" in Python guys ? It's not the language that will make a good/bad programmer ... You can write bad code in both languages, also you can write clean and maintainable code in Java as well.
Billy
-1 for being nonsense
willcodejavaforfood
Note: I'm from Belgium and here exists a strong distinction between college and university: college is very, very simple in comparison with university. So I'm refering to the lower-end college in the U.S. I suppose.I think he's trying to say that the reason there are so many Java developers, is that they're taught by the masses by college. And most of the time, that's all they know: the IDE and Java (or the IDE and C#). They typically are incapable of learning new techniques, nor do they want to.Python is typically self-taught, (s)he *wants* to learn.In the end, the latter will be better.
Wim Leers
Wim - what a load of crap.
JeeBee
The strict typing in Java as compared to the duck typing in Python, is in my experience the difference that makes it feasible to build enormeous programs (like Eclipse) in Java, which can later be changed and still be sturdy.
Thorbjørn Ravn Andersen
Wim - yeah, that's kind of what I was getting at.willcodejavaforfood - Maybe it's time for you to branch out and try a different language. I'm sure you're a very competent Java programmer, and there are a lot of very competent Java programmers everywhere. There are also a lot of really, really bad Java programmers (if only for Java's popularity). Python is a do-it-yourself-because-you-care kind of a language. That's why I'd argue that there are fewer bad Python programmers (by percentage).
Alex Gartrell
+8  A: 

If you have no Java experience, you could use Jython to allow execution of Python via the JVM.

In terms of best for the business, does your management have a technical (or solid business) reason for wanting Java? If the answer is yes, then what's good for the business and you is developing in Java. If there are no reasons other than buzzword compliance you may want to lobby for Python.

John Percival Hackworth
+1 not only Jython, but JRuby and Groovy are very powerful. You get full access to everything each language has to offer as well as potential reusability of existing Java code.
basszero
+3  A: 

Disclaimer: I am seriously Python biased.

I suppose the question is why does management want to rewrite in Java. If its a reason like, we only use Java so that people can switch teams and be acclimated quicker that's one thing. If its for another reason you'll have to decide if its worth arguing against. Python integrates well with C so as you rewrite you can use the code you've already written. Jython gives you the option to bring in Java libraries, but you don't necessarily need them over standard Python's.

Honestly though, I don't know the situation as well as you do. You will have to make the decision. I guess because you are asking the question you really want to move to Python over Java.

+4  A: 

Since you currently use XML and PostgreSQL, put together some sample code based on your existing codebase that works with each technology and use that as evidence with managment. My guess is that good Python will be more concise when dealing with XML and I have no idea about the PostgreSQL in Python.

Kevin Hakanson
+1: Show the productivity by building a transaction in Python more quickly (and simply) than Java folks can.
S.Lott
+10  A: 

If your C codebase is large, throwing that out for The Big Rewrite could end very badly.

How about creating some hooks for Python to drive your C codebase, and using Python for new development? There are many options for this, in order of ease (IMO):

  1. Use cython to make modules that call into C libraries
  2. Convert your libraries into DLLs, and use ctypes to call them
  3. Write python module wrappers around your libraries

If your C code isn't extensive, then maybe starting over would be an acceptable risk. In that case, it comes down to taste and availability of programmers, but if you go the Java route, I'd at least push to get Jython accepted.

Ryan Ginstrom
Indeed, if you plan to use your C code, go for python.
alamar
The C code is extensive, but much of the bulk of the C is in handling the home-grown database. Going to Postgresql will remove about one third of the code. And much of the C will disappear as we will be able to dump our home-made libararies for Python/Java built-ins. We have worked on the C for 10 years, rewriting it to Ansi C standards, rewwriting it for new libraries we developed. We know this code so well, and have rewritten it so often, we are eager to rewrite it again to get the business moving faster, and kickstart our careers.
codebunny
+2  A: 

IMO, the thing to know about programming in Java is that while you can do it in a very low-level-C-like fashion, and while there is also a lot of needlessly "enterprisey" code out there, you can equally write clean, sensible code. Unit tests are definitely well-supported through JUnit, and there are massive libraries available that make your life easier.

This is not to say that you should absolutely choose Java over Python, as both have their merits. But Python is more fashionable than Java at the moment - and it's worth investigating what well-written Java is like rather than to take the fashions at face value.

The book to read here is Joshua Bloch's Effective Java, the de facto bible on writing sane Java code.

Zarkonnen
I'm glad to see someone emphasizing the importance of the programmer and not just the programming language.
Zsolt Török
+4  A: 

I tried both worlds, but just occasionally in java, and I am strongly biased towards python. My experience is that Java is very time-consuming. You have to write a lot to achieve what you want, unless you use a memory hungry IDE (Eclipse) which basically codes for you (if you know how to use it, which also requires consistent learning time) and you hook into as many libraries as possible that do the task for you. On this regard, what you code is just glue code between libraries without the advantage of having a scripting, dynamic language like python.

On the plus side, in java you have a lot of libraries, while in python sometimes you don't have them. However, if you have to interface with C, python is the best choice.

Stefano Borini
+1: I chose Python for the same reason. Java is more work.
S.Lott
Sadly business programming is about taking these libraries and glueing them together with a data model in order to get a working solution. You simply can't dismiss the ability to drop your Java application into Axis in Tomcat to get a fully web service enabled solution with very little effort or time investment.
JeeBee
Since my experience is that Python is considerably less effort, I actually can dismiss Java as too much work for the value created. I've been developing in Java since the 90's and Python since the '02 or so. I have considerable experience that allows me to dismiss Java as too much work.
S.Lott
+3  A: 

If management suggests a given platform there is usually a good reason for it. One might be that there is more people capable of maintaining your code, which is usually a good thing. Setteling on one implementation platform actually makes sense :)

I have been in your shoes with Perl instead of Python some years back, and found:

  • The wordyness of Java is a psycological issue, not a technical. Modern IDE's are very helpful, and auto-completion allows you to just type some of the characters. It helped a LOT when I simply decided "I like this language, period"
  • Java programs have proven to be very maintainable. The rigidity in the language pays of in terms of robustness of the programs you create, even on a very large scale and the wordiness helps readers understand your code.
  • Java has a enourmous user base, and a gigantic set of user libraries "out there". This helps when you do not want to write all the code yourself.

But in your situation you can always settle on Jython, and just write all your stuff in Python and run it on the JVM :-D

Thorbjørn Ravn Andersen
-1: "good reason for it". Sometimes, but not often. Usually the reason is based on Fear, Uncertainty and Doubt more than facts and business value.
S.Lott
S.Lott, depends. Here there is a very valid point about having ONE instead of TWO languages in the inhouse solutions. I still maintain that it would be a good idea of the poster of choosing Jython as it runs in a JVM, having only a single platform.
Thorbjørn Ravn Andersen
+3  A: 

I don't think you can have a clear cut answer, in terms of languages it would be very hard to come to a definite and objective conclusion based on hard evidence, part of this is in the eye of the beholder ...

What the other guy is pushing for - unit tests, frameworks, etc - could probably be done in Python as well. I'd go for java because there are certainly more open source frameworks, code examples, forums, etc as it's been around longer than Python.

But this is a theoretical debate that doesn't mean much in your precise case, because for your precise problem you'll be solving, both languages might do, in a different area there could be 100 java frameworks and only one Python, but if you never go there ... it doesn't matter to you.

So you need to find out what works best for your team and your app, and I think you need to do some experimentation on your own in order to get more than just a feeling.

I suggest you try to allocate some time ( one-two weeks ) to a couple ( 2-4 ) developers from your team, and have two teams ( 2 guys per team will be better than one per team, but it depends on your resources/priorities/urgencies ) and have each team do a spike solution to one specific functionality from your current code, one team will investigate how they'll do it in Java, the other in Python. It sholdn't be fully implemented, just get their hands dirty enough to get a better feeling for each language. The teams should be equivalent in terms of knowledge, experience, etc.

After the two weeks you'll be able to compare the experiences of those two teams and have a better idea what will work for you.

Java might be a better choice on paper, but if your team would be more confortable with Python, there's no point in trying to make your own life harder, if you ( as in your team ) don't like what you're doing ( the language ), you'll be less productive and have worse results on long term ...

Billy
+2  A: 

Well if management wants to limit the languages in use within the company, then you will have to argue for Python as being the scripting language that is used, and maybe argue that there should be a scripting language in use. This might be difficult if you have a lot of Perl used in house as well. There is a desire to avoid language explosions in most companies, as it's harder to hire skilled multilanguage programmers.

Also don't discount how quick it is to write an object based web service in Java and not actually have to deal with XML at all, as the SOAP/REST layer will do that automatically. The Java front-end guys can then use that web service instead (you can provide them with the client library, indeed they could provide you with their data model to give you a head-start with your implementation, it shouldn't be about you and them, you should cooperate to get the best solution for the company). The main benefit is that with Java on both sides, you won't get implementation issues with the web service.

And then you can sneak in Jython for extensions that you write yourself. Adding this to Java is incredibly easy I've found, especially as an interpreter running Python scripts.

JeeBee
+14  A: 

"We have begun working in Python and love the simplicity, the terseness, the rapid development."

Good points. Those were why I chose Python over Java. I also had Java folks lobbying for Java.

However, while they were still lobbying and hand-wringing, I had prototypes of the site up and running in Django on my laptop.

Add to this the following:

  • Direct interface to your legacy C code. You can -- with minimal work -- write Python to C glue code and invoke legacy C from Python, easing the transition. This requires refactoring the C to clean it up. It's not mandatory, but it's an option that's easier in Python than Java.

  • Unless you make use of some Python features (multiple inheritance, operator overloading for instance) you can trivially translate a clean, simple Python program to Java. I offered this to my management. At any time, we can pull the plug and rewrite as Java. Rewriting Django to Struts will be a lot of work, but it's technically feasible and can be done by n00bz or interns.

My focus in justifying Python is

  1. Speed of development. I can crank out working code before the Java folks have stuff that will compile.

  2. Flexibility. I can refactor and rework a module in an afternoon. The Java folks have to redesign things on paper to be sure they can get some of the bigger refactorings to recompile. In Java, the changes aren't as small and focused.

    I should probably blog about some of the nastier refactorings that would be a huge pain -- even using the refactoring tools in Eclipse or NetBeans. The most recent example was a major change to the top-most superclass of a class hierarchy that would have invalidated a mountain of Java code. But the method was used in exactly two places, allowing a trivial change to the superclass and those two places. 100's of unit tests passed, so I'm confident in the change without the compiler overhead.

  3. Simplicity. Python doesn't need a sophisticated IDE and super-complex WS libraries. Python code can be written in Komodo Edit. A WS interface between your Java front-end and PostgresSQL can be knocked together in Werkzeug in a day. You can plug your transactions into this without much overhead.

Bottom Line Build a demo of your middleware in Python. Trump the deciding and hand-wringing by offering a working solution.

S.Lott
A: 

Last year I wrote a glue application for a customer that queries an Informix database and formatted the results into a text file for import into an AS400 system. No GUI required all controls in a properties file. I wrote the application in Java. The reasons for Java was mainly for the portability as the application had to run on both the Windows and Linux platforms. Also the JDBC connects to most relational databases easily. Some time later I had the opportunity to write a similar application and this time I chose Python. It was my first real Python application and I was impressed by how easy it was to write and how much shorter the application was in terms of lines of code. The performance was about the same.

This year as an intellectual exercise I rewrote the Java application in Scala http://scala-lang.org and I found that this really is an interesting language. I certainly falls behaves like a scripting language with the portability of applications that run on the JVM and with interesting features. I will certainly be writing more applications in Scala in the future.

TomPC
+1  A: 

To be clear up front, my experience with Python is very little while my Java experience is fairly robust.

The reason for choosing a language should ALWAYS be determined by the problem that is trying to be solved. It is hard sometimes, but for anything business related you MUST resist the urge to choose a language based on how sexy it is at the time. In this case your application seems to be screaming "enterprise" (loads of business logic, database backend, interfacing with outside sources). When I hear that word the two languages I think of are Java and C# (or other things .Net). To get more specific, these would be my reservations about using Python over Java:

1) Type Safety - I'm sure that others may feel differently, but for large business heavy applications (especially with an unexperienced team) it is dangerous to allow dynamic typing (Python). This will lead to RUN-TIME errors because casting isn't checked at compile time. Java is statically typed and, with some help from Generics, can eliminate most casting issues.

2) Programming Paradigms - I'm not trying to say OOP is better than any other paradigm, but I do want to note that Python allows many different paradigms to be used. This is really cool, but can be hard to manage among many programmers, especially if they are just starting out with the language. It is actually interesting that you called Java more C like, when it is Python that allows functional programing. Another note about this before moving on: if you try to program in Java like you do in C you are likely in for a bumpy road - I can not express in words the pain when trying to maintain a Java application that has been written to look like C.

3) Usage Scenerios - Again, my lack of experience with Python may be evident here, but it seems that where Python shines is in Web-based environments or for scripting-type tasks. This seems to be exactly what you are NOT doing. J2EE is expressly designed for these types of things.

Those are just the first things that jump to mind (though points about libraries, IDEs, and community support/documentation could also be made - not to mention whitespace issues). Please note that I'm not trying to trash Python or any of its features - it seems really cool and powerful - but using it in this case will cause you MAJOR headaches down the road in this environment. Trust me.

One last thing, do you and your team a favor and take some training (either web-based or classroom-based). It is worth your time to fully understand whichever language you choose before design and implementation or you may be creating more problems than you had with the C program.

dball917