179 points · by myko · 13y ago · 124 comments
I wrote the talk, and just want to let you know that you can watch it over at https://www.youtube.com/watch?v=p77BR6e1uoo
--Chris
After seeing your comment I went back to it, and indeed, the talk is there, which was unexpected and great.
I really like how thoroughly you cover the problems with and potential work-arounds for using a non-Java language with Android. Your analysis applies to many other languages besides Python. I wonder if it would be worth making a language-neutral version of the talk.
Why isn't Kivy or one of the other existing solutions good enough for your needs?
(I talk about iOS, that I care most. I wish badly that I could use python instead of obj-c)
RubyMotion is probably the closest I've seen to making a language like Ruby or Python a very compelling mobile developer experience while maintaining the end user experience.
That basically means you need to write a Python compiler for iOS or Android to make it compelling, which means adding type checking and at some point developers start asking why they aren't just using Java in the first place...
That's correct that the type system is the crucial attribute as a platform language. But that's not the only reason. It's also for correctness, safety, productivity and manageability.
That's because a platform is huge and complex monster. So all those properties are archive-able only by automated tools, and those tools need rich metadata for each word of code. Type information is crucial metadata, and it's mostly impossible to make high quality tools without those informations. That's why all the designed modern platform (=system) languages are all mostly typed. From C/C++/Objective-C, to Java, C#, Go, Rust, Dart, TypeScript…
In fact, it doesn't matter the language actually statically typed, dynamically typed, duck-typed, or completely untyped. The point is an ability to offer accurate metadata for automated tools, and type system is the best ever invented. So languages lacks the ability cannot be a platform's primary language.
> bad developing experience, code needs more debugging, it is harder to maintain and overall productivity is lower
All of these observations are highly subjective.
> Developing experience:
I much prefer developing in python than java. If IDEs factor in, there are a number available for python, none of which I use, because I find a simple editor is usually enough.
> code needs more debugging
That's a function of the problem and the developer. The run, check, edit cycle in python is a lot quicker than using your IDE to run, check, edit, compile. There are debuggers available for nearly every language that allow you to step and inspect.
> harder to maintain
Disagree. When you have code 1/5th (number pulled from my ass) the size codebase, maintainability can be much better. Unit testing helps, regardless of the language.
> productivity
A developer proficient in language [X] should be just as productive as a different developer proficient in language [Y]. Creating a massive type hierarchy of classes and interfaces is a tonne of overhead when you are trying to express a simple idea. In a language like python, you might write a simple class (or two), and use dynamic typing appropriately. A java developer may use code generation and IDE shortcuts to lessen the amount of total code they have to write though.
The advantages and disadvantages of dynamic and statically typed languages are fairly well known. Neither is perfect all the time and for each person. Just because you don't like dynamic languages, it does not mean they don't have their virtues.
> code needs more debugging, it is harder to maintain and overall productivity is lower
References?
Titanium is open source; the repository can be found on GitHub.
Hasn't held anyone back on non-mobile systems, right?
And I'd probably be working to improve Jython as we speak.
PS. See you at LCAU2014!
It was mentioned in the Pycon 2012 keynote I think, a source: http://jjinux.blogspot.com/2012/03/pycon-keynote-guido-van-r...
Python was simply not a first-class citizen on Nokia devices, 99% of development was done in C/C++. That's one of umpteen huge boats they missed at the time.
Being able to REPL on a device from a terminal on another machine was fairly useful though.
No, and no. I don't think Nokia ever shipped any significant amounts of Python code themselves.
> Were they interpreting or compiling Python?
It was the standard CPython interpreter.
[Even with pretty unoptimised python].
I'm not as familiar with iOS ... is there broad language support for that OS?
Part 1 was there to lay the groundwork. Basic? Maybe, but it's necessary.
I used to follow it initially but noticed the project seems to have slowed down. There haven't been as many releases lately. Anyone have more info on why that might be?
Another area of deficiency in the Python ecosystem that concerns me is the lack of any client-side web development story. Languages like Clojure and Kotlin clearly recognise the importance of this, yet as far as I can tell there doesn't seem to be much interest in projects like Pyjs.
When I think about most Android apps I use (and especially my toddler daughter's games), I can't imagine 95% of them need the faster execution speed of optimized Java or NDK code. IOW, they could have been written in Python and enjoy:
1. Faster development 2. Portability across devices
What kind of penalty comes with a separate python runtime?
If you want performance, write it in C, optimise it. That's what the NDK is for.
The main difference is that most other platforms run in native code and then VM languages bind to that native code (e.g. Python/Java calling out to syscalls, WINAPI functions, etc...) while Android OS actually is written and runs IN Java. As soon as basic Linux kernel is up, Dalvik is started and THEN the rest the OS (UI compositor, audio manager, process/activity manager, SurfaceFlinger, etc.) is loaded as Java classes. Android is basically Java code that calls out to native code for acceleration (like most Python libraries) not the other way around as you're used to from other platforms. Think of Android more like "boot to Java" than a Linux distribution.
Which means there are no native calls to be called - whole Android API is a Java API. So if you want to implement another language or write an app in C, you need to still have a JNI bridge between your language/code and Dalvik which lets you call Android to draw UI on screen, access data about filesystem, system services, schedule service startups, add icon to launcher, show notifications, ... anything really.
This is also probably the biggest reason why we're not seeing other languages on Android - binding Python and Java API together isn't really easy, especially due to different language design philosophies.
My guess is that someone will write a pythonic UI framework based on the Android API...
The problem I raise in the talk is that such libraries will always lag behind the state of the art for Android GUIs, which makes them less attractive.
It reminded me of this: http://www.tinypy.org/
Meanwhile, Lua is not doing bad in both Android and iOS.
Guido is working in Google, and Google doesn't support Python on Android. Python is just secondary scripting language even in Google, can't take a strategic support. Their primary product/platform language was always languages with forced type (an)notation - Java/C++.
Same thing happen on C#. Anders Hejlsberg couldn't convince any other MS product teams to use C#, so C#/.NET literally abandoned for years. MS is advertising C++11 now, and Mr. Hejlsberg is working on another C#.
As far as I remember, the only support was XNA came from DirectX team, but it actually discouraged the addition of C# by proving inferiority of C# on game development.
Regarding C# and/or .NET's abandonment - is this really the case? It certainly doesn't seem like it, with new revisions of the CLR coming out somewhat regularly, seemingly with new bits in each time. There's been LINQ, this new async thing, Rx, and that XML UI thing. And I know Silverlight is dead, but nothing dies without having been alive first! And I'm sure if you actively pay attention to the ecosystem - I don't, I use C# as a fancy MFC - you'd be able to reel off a whole pile of other things. It might not be quite the PR darling that it was in its youth, but it doesn't quite seem dead yet...
It might be true that teams at MS don't use it.
I invested much time on C# 1.0 to 3.0 for XNA, and MS never give a shit on XNA for years and finally fucked me up. XNA doesn't exist anymore. Happy time with MS was the biggest reason made me to learn C/C++. Ironically, now Unity3D is working well with that C#.
Anyway now I am on C++11 on Xcode(You should know what I mean!) and happy because I don't need to worry about any abandonment. C/C++ is core language for any practical platforms (including browsers!), and I don't need to `IDispose` all my source codes by vendor's decision.
XNA stuff was my personal experience, but at least for me, MS surely abandoned the platform, and will do it again at any time. And this was possible because their core teams are not using XNA. In other words, strategic support.
Maybe not yet on other fields, but I feel the time is close. The proof is, of course, the TypeScript. If you haven't checked it, google it right now. MS decided to make a new language instead of porting CLR on Javascript. I am sure that stuff is post .NET/C# (I mean post buzzword) of MS. If you don't believe MS will abandon .NET, think about how MS themselves will be damaged if .NET abandoned. Virtually none. None of their product core is based on .NET. Anyway even after they abandon .NET, it will keep taking periodic update like they did on ActiveX for last decades.
And it is not just about direct user experience either.
Even if a given app may be written in Python it will probably drain the battery faster, since for each bit of work that would have taken X cpu cycles with Java, you would spend 20X with Python, not to mention memory handling, etc...
A language is just a tool, use the right one for the Job.
a Pythonista
To get a simple button on the screen, you need an Activity with a Fragment with a View with the button inside, with a few more layers inbetween. The gui is loaded from multiple XML files and resources, with lots of dynamic property binding going on. And even don't get me started on data storage and SQLite...
Writing an app in python wouldn't add much to this - it actually may allow you to avoid a couple of layers (the dreaded FactoryFactory syndrome of java). Python's weakness is number crunching, and I agree, you wouldn't want to do that in Python on Android. But just to show a gui, or to access a web api, python's performance should be more than enough.
Just like when you're coding in Java, code that needs performance is native, and written in C.
Python would idle just as well as pure java if it needed to :)