Posts Tagged ‘java’

Tabs vs. Spaces

December 1st, 2009

Every time I’ve seen one of these “vs” posts its gone into great length about the philosophy behind such and such.  You’ll never convince someone based on ‘religious argument’. So I’m going to take a different approach here and state who does what and hopefully the weight of ‘who does what’ will make the point quite clear.

Screw the Scientific Method!!

Language/Organisation Spaces Tabs Reference
PHP Pear * [1]
Zend (PHP) * [1]
Python * [1]
Ruby * [1]
Java * * [1]
.Net * [1]
C# * [1 Philips (PDF)] [2 - Microsoft]
Lua * [1]
Erlang * * [1]
Object Pascal * [1]
Adobe Flex * [1]
Ada 95 * [1]
Mozilla (Javascript) * [1]
Mozilla * [1]
Google * [1] [2]
Mono Project * [1]
Webkit * [1]
NASA * [1]
Apache (C) * [1]
Linux Kernel * [1]
Gnome * [1]
KDE Libs * [1]
Joomla * [1]
Wordpress * [1]
Zope * [1]
Django * [1]

Notes:

  • Tabs may be rendered differently on different editors and systems.  So they make for less friendly code sharing.
  • Its interesting to note that the ones using tabs all have histories of mental instability, cannibalism, Morris Dancing, witchcraft and heresy.

Clear win for Spaces, which happens to be what I use.

ASE Makes Android Development Pleasant

July 12th, 2009

android-logo.jpgHaving got myself a G1 phone a few weeks back I’ve been tinkering a lot. Mainly with the Android Scripting Environment that I plan on writing about soon but I thought I’d give a quick summary of what I’ve found so far on this platform – and why I don’t like it (kind of)!

It uses Java – of a sort. More specifically it uses the Dalvik VM which is a register based as opposed to stack based VM and has many of its core classes based on Apache Harmony.

(Did I sound like I knew what that meant? Because I didn’t. I was paraphrasing Wikipedia – I love Wikipedia’s ability to make you sound like an expert at anything)

That’s why I hate it – the Java part. I hate Java. I’ve not developed in Java since university and have conducted a mental cleansing of all my painful memories of the language. As such I am a desperate ‘newbie’ on this platform. Scrabbling round like some lost raccoon on the North York Moors (there are no raccons in England so it would be VERY lost).

ASE comes to rescue the day but first….

Why ASE? Android programs are ‘easy” enough to write.

This is in the wiki docs of ASE. This question gets asked – apparently quite frenquently.

All I can say is: “Holy mother of jesus-bloody-ballsing-christ”.

What I find even more shocking is the answer…

That’s very true. Android’s development environment does make life pretty easy.

PRETTY EASY?!?!

WHAT?!?!

Are you a masochist??

It took an hour just to get it all up & running. Getting Eclipse working how its meant to with the right plugins, setting up emulator images, downloading tutorials and the multitude of other faffing tasks.

If you’ve gotten used to scripting languages like Python, Ruby or PHP then programming Java is akin to stabbing your eyeballs repeatedly with a rusty fork. Its rammed full of verbose bullshit, silly configs, insane amounts of setup, strict typing, misery, self abuse, pain, kitten torture, puppy genocide, etc, etc.

For example try taking a look at the Android Dev tutorial. Part 1 will consume 6hrs of your life. After which you will have created a useless ‘notepad app’ that doesn’t allow you to edit or delete notes. Only create a new one with hard coded contents and a name. 6 hours and I could have built Athens Online – an online city of dreams and Greek pornography. What? Everything online is porn.

Anyway…

Java Can Come Later

I hate JavaThe Android Scripting Environment is a breath of fresh air though. This was released in May/June and allows development of quick, funky scripts in Python, Lua or BeanShell (*hiss*, *spit*). Ruby and Javascript are to follow soon.

If you fancy developing the scripts on your PC and running them on the phone you’ll need a tool available in the Android SDK called ADB (Android Debug Bridge). Though if you’re following the ASE docs don’t forget you need to turn on USB Debugging on the phone to enable it.

What It Can’t Do – Yet

I love ASE and I love the German gent who made it even more – even though I know only his name. I’m sure that he’s a great man for only a great man would create ASE.

Okay – I’ll stop now.

ASE can’t do the following at the moment:

  • Compile in to APK/packages for selling or distributing on Market or elsewhere.
  • Its restricted to a subset of the Android API made available by an RPC interface.
  • It can’t cure cancer.

I’ve got high hopes for ASE and its making my life more fun. If you’re a Python/Lua/scripting sort then you’ll love it too.

Python GUI Programming? Painful

September 3rd, 2008

If you’re wanting to develop a Python GUI anytime soon can I strongly suggest you re/learn Java. I recently wanted to produce a simple yet functional desktop app and decided to give Python a go. I’d later py2exe my creation to create an executable Win32 app. My thinking was that Python is much faster to develop with and so doing a simple GUI app using it must be simple too.

Oh how wrong I was.

Coding the GUI

First off I tried the oldschool method of developing the GUI by hand using Tkinter as it seemed to have the greatest level of documentation and it was the library used in the Programming Python book. Alas this brought back painful memories of oldschool Java GUI programming with extremely restrictive rules on placement and positioning. After 3 hours of trying to get exactly what I wanted I ended up with GUI cat-sick on my screen – not good.

I tinkered with a couple of ther other libraries wxPython, PyGtk and even EasyGUI (too basic) only to hit the same problem – lack of flexibility.

I decided to try a different approach and find a GUI capable of handling the graphical side of things for me – maybe its a cheaters way out but personally I wanted an app not an education.

PythonCard

Oh dear god in heaven above. This app has been getting developed in a cave by the most hardcore, life-starved, miserable geekjects on the planet. It’s based on an age-old Apple Mac application for developing quick dirty GUI apps. Which is great except its method of working is completely different to any other IDEs out there. It does follow a convention – its just the convention died years ago. That doesn’t deter the developers though and they still have arguments to this day about wether to make tab ordering an easier to access feature or just leave as is (NB: Tab ordering is determined by the ordering of the elements in the frame and so you use “send to back”, “bring forward” commands – very intuitive).

Boa Constructor

You need a book to operate this and also colour blindness helps because the interface is…well….vile! It’s a painful mess to use and I didn’t even bother trying – I closed it down in disgust. End of story.

IronPython Studio

You need a full version of Visual Studio – no go.

PythonWorks

Project now dead.

PAGE (Python Automatic GUI Generator)

This is one hell of a piece of wonder. Its amazing the sub-sorry I can’t be sarcastic any longer. It’s rubbish, it performs a role and thats it. It simply generates your GUI code rather than being a full GUI IDE.

I eventually got onto Glade and there’s a number of options here that Python can exploit however, I’d wasted far too much of my valuable time by this point so I decided to do the only sensible thing:

Remember My Java

I left Java many moons ago but from when I’d last used Netbeans I remember the GUI building facilities were absolutely stellar. I wasn’t disappointed this time round either. I can’t believe how far along its now come and developing a GUI app in Netbeans using the Swing and SwingX components is an absolute joy. Its making me want to make more and more – I’ve restarted learning Java and not looking back.

So if you want to create a GUI desktop app – don’t use Python (or Ruby).

Sun’s Gosling on Ruby and PHP

March 15th, 2006

I spotted a recent article while on the Riding Ruby blog in which James Gosling of Sun – aka: “Father of Java” made extensive comment regarding Java’s placing with Ruby, PHP and other platforms.

“PHP and Ruby are perfectly fine systems, but they are scripting languages and get their power through specialization: they just generate web pages. But none of them attempt any serious breadth in the application domain and they both have really serious scaling and performance problems.”

Scaling and performance problems have been shown to be null and void when Friendster switched from a Java platform to a PHP platform and had a noticeable speed improvement – Friendster is no shrinking violet, once boasting the largest social network on the web.

Scripting Languages?
That comment jars a little as its a far out dated term normally reserved for cheap pot-shots. I’ve had numerous discussions with Java advocates in which Ruby, Python and any other dynamically typed language has been dismissed as a meer scripting language. It doesn’t look like I’m the only one either as Ryan Tomayko at Lesscode.org seems to have paid comment to Goslings post in quite some depth and I recommend a read!

UPDATE: The Artima Developer forums have a thread sicussing this topic available here.

Java reaching the end of the road?

December 1st, 2005

An article over at the Register offers up a number of interesting points on the future of Java. Yes, I know its been said many times that Java’s days are numbered, but with the increasing availability and popularity of languages like Python & Ruby. What the report also points out is and Java’s increasingly complex and bloated base making the system unwieldly and difficult to use for anything but enterprise projects.

The Java platform is becoming increasingly complex, the JVM has an obesity problem, the addition of generics has added complexity to the previously clean syntax, the layers of XML configuration required to plumb a full J2EE stack are weighing developers down. Tate puts a lot of this down to the fact that the big players (starting with Sun and IBM) are focused on large-scale enterprise development projects.

Is this the beginning of the end for Java or is it merely moving onto new pastures? When it leaves though it’ll most certainly be replaced by the new contenders Python, Ruby and their frameworks; Django, Rails, etc.