103 points · by sebg · 10y ago · 127 comments
It's good that we've finally been able to agree on a common set of tools to make UIs, it's just too bad it had to be this one.
The HTML/JS/CSS/DOM mess is a pretty terrible solution that we seem to be stuck with.
History is peppered with UI authoring tools that were better but stewarded by companies that held to tight licensing that stunted their growth. Hypercard, delphi, adobe flash (and FLEX - which looks a lot like react), even unity has more intuitive wysiwyg UI tools that could have proved versatile with the right stewardship.
The difference is vertical integration. These companies made their tools complete solutions and often went so far as to put virtual machines on everything to interpret them correctly every time.
The article's author touches on the license problem with python's own pretty damn good QT lib.
If only someone could find a way to make a good tool without fucking up licensing.
The licensing for Qt itself is very simple: if you redistribute and don't go GPL, you have to pay. It's one of the fairest arrangements out there. PyQt has similar terms.
The way that makes most sense to me is charging for the authoring tools and making the language/VM completely open (e.g. MIT license).
Maybe that's too idealistic?
You're implying that they should charge others for the parts that you don't care about? If only they had been a bit more creative...
HTML is actually one of the most powerful layout engines out there, Javascript is as versatile and powerful a language as you might want to ask for in 90% of the cases, CSS has it's flaws but they are being addressed and is fine for most styling issues and DOM is just a very easy to understand albeit crude way to handle objects.
All in all a combination of tools that makes it extremely easy to get started and se results right away. I believe this is also on of the reasons why PHP is so popular. It's ability to seamlessly integrate with that "mess" either to take over the formatting or to fit into the existing formatting.
It's a conceptual framework thats closest to what we as humans understand.
Pythons problem like most other programming languages including Objective-C and Ruby is that while they are elegant and powerful computationally they are horrible for most people to get started with because just setting it up in itself is a big task.
So I don't think we are stuck. In fact I believe that if Python would take the same laize faire approach to the mess as PHP it would be much more popular than it is today.
But it's terribly verbose and isn't extensible. XML was extensible, but even more verbose.
Also, I wouldn't say that HTML is a layout engine; CSS is the layout engine while HTML denotes the structure to be laid out.
> Javascript is as versatile and powerful a language as you might want to ask for in 90% of the cases
Erm, no. It's a terrible little language with some horrible misfeatures (==/===, {} &c.) which has one virtue: near-universal deployment.
> DOM is just a very easy to understand albeit crude way to handle objects
I've never really thought the DOM was all that easy to understand. Attributes vs. nodes, text nodes in unexpected places — it's a mess compared to a nice tree of strings and trees would be.
> It's a conceptual framework thats closest to what we as humans understand.
No, it's the conceptual framework we ended up with, so we all have taught ourselves and been taught to understand it.
> Pythons problem like most other programming languages including Objective-C and Ruby is that while they are elegant and powerful computationally they are horrible for most people to get started with because just setting it up in itself is a big task.
sudo apt-get install python
python
Python 2.7.9 (default, Mar 1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> "hello world"
'hello world'
>>>
That seems pretty simple to me.Your answer perfectly illustrates my point.
You focus on the wrong things. None of your distinctions or interpretations of what I say are wrong per-se, they are just not important distinctions.
The fact is that people can quickly build a webpage with all the bells and whistles in an environment they undertand without having to install anything or rely on dependencies to get started.
They can fiddle around, experiment with it in real time etc. they can play around with it so to speak.
It doesn't take itself too serious. It doesn't have a "guardians of the right way" saying how it can and can't be used.
You can still go to town and go crazy in making perfectly optimized code but it's not demanding that from you.
These are the important bricks in creating something that is powerful. It's ability to function as a toy for the very novice people. To easily provide them with visual feedback with assets they can relate to (cat pictures, video they saw somewhere) etc.
This is what VB had this is what HTML/CSS/JS/DOM/(PHP) has in spades. The non-judgement of the experts.
There are things it's optimal for but luckily we don't live in a world were people only do what things were originally meant for.
I am using gmail in the browser. I am discussing this with you. I am transferring money between accounts, playing games, filling out surveys, controlling projects, looking up routes on map, enjoying streaming music, video etc.
It's all good.
We are now in the year 2016, not 1996. Browsers moved past the "networked document viewer" stage well over a decade ago and have been deliberately evolving into full application platforms ever since.
A. Open your favorite terminal emulator
2. Type "python"
D. Press "enter"
Also, I think you meant laissez-faire.
One fucking language.
Looked the same on every device.
And it wasn't hard to get a project going. We are making a fucking computer application, not boiling water for tea.
Now everyone thinks it's progress and noteworthy and oh-my-fucking-gods-amazing to do this shit with fucking HTML, CSS, and JavaScript. What. The. Fuck.
Can't Silicon Valley startups afford developers who can...you know...learn technology and write some code? Is SV only able to disrupt the world by leveraging a browser every damn step of the way?
We are fucking modern-day wizards of techromancy who bend electrons to our will. We are the closest we've ever been to magic (since 1969). We come up with ideas. We make them something fleshy bags of water can poke at with their greasy, grubby, sausage-like fingers while they chortle and snort and spit their Cheetos on their screens. All by just futzing about with some incantations we spill out via keypresses. We can make just about anything that doesn't violate the laws of physics, and we keep defending HTML/CSS/JS as anything other than a horrible fucking wreck that steals our babies in the night, and thus our joy.
Nothing about the browser stack is a conceptual framework that is closest to what we humans understand. That CSS has made slower progress in not being a shitshow than Python 3 is fucking abominable. That everyone is clamoring for JS to get all these proven-to-be-holy-rocket-ship-to-the-heavens features other languages have had for-fucking-ever, and had better, is just sad.
What we seem to be creating is an entire decade of developers who can't seem to work without the browser stack. And that's a problem. Because we are going to be reaping the rewards of this for a long while. Browsers need to move beyond, developers need to move beyond. HTML is great when all you want is a motherfucking website.[1] CSS is fine if you're looking for a better/best motherfucking website.[2] JS was cool ... once upon a time.
All three being the primary path taken for building every new thing just feels sad.
[1]: http://motherfuckingwebsite.com
[2]: https://bestmotherfucking.website
[3]: While it's always good to use the best tool for the job, that shouldn't mean we stop creating better tools. Right now, the browser stack just seems content to keep adding more tools into the toolbox, instead of inventing the fucking cotton gin and automated harvester.
Most people are finding value in very very simple even simplistic things.
Instead of being offended by that instead find solace in the fact that you can create things most other cannot.
> If only someone could find a way to make a good tool without fucking up licensing.
The rest of your comment is quite intelligent, but I find these lines to be quite the opposite.
PyQt is available under both the GPL & a commercial license (https://wiki.python.org/moin/PyQt/PyQtLicensing). What you & the article author seem to want is for other people to write software that you can use and modify for free while you charge your own users to use and modify the software you write.
That's, in a word, hypocrisy. If you want to distribute a commercial PyQt app, then buy a license; otherwise release under the GPL (or a compatible license).
Not saying it was super easy to use (took me a while to get drag & drop working the way I wanted, I even ended up subclassing XmText to get rectangular highlighting) but it sure was nice, I wonder what would've happened if it had not been commercial but had been available on an open licence to start with.
I don't have a fully-formed hypothesis, and I like native apps better than WebKit/electron based apps just like the next guy, but there has to be something to it, no?
Seriously, if anyone thinks HTML/CSS is easy to write UIs with, try Tcl/Tk or Rebol.
# time yum
real 0m2.147s
user 0m1.276s
sys 0m0.772s
# time apt-get
0.00s user
0.00s system 91% cpu
0.004 total
The author wants more Pythonic GUI apps because s/he thinks it produces more readable code. It has been argued that such code can be slower ( http://lukauskas.co.uk/articles/2014/02/13/why-your-python-r... ) and maybe it will lead to trading too much developer pleasure for user pleasure.
In many cases - developer time or cost is the constraint. Therefore it might be the difference between something existing and not existing.
It's a similar argument with 'native vs other' on mobile. Currently native apps are obviously better in terms of speed and overall quality. However - much non-native software simply wouldn't exist if there wasn't a rapid, low-barrier to entry development option.
It's not the same in GUIs where the startup time doesn't usually dominate, but it's easier to keep the main loop spinning at 60 Hz to avoid dropping frames with a language implementation that is faster and not encumbered with a GIL.
https://talkpython.fm/episodes/show/58/create-better-python-...
# time dnf
real 0m0.236s
user 0m0.152s
sys 0m0.070s
Substitute Python with PHP and it feels like 2004 again. I think we all agreed a long time ago that decoupling presentation layer from business logic was a good thing, no?
However that's a deal I'd consider taking if it means I could write more Python more of the time.
I think you will see applications that are quite generic (look and feel) and very chatty, but quick to develop.
1. Just write Python and get interactive graphs
2. Write Python and small snippets of embedded js when (1) is too limiting
3. Write Python to generate the datasets, and proper javascript via bokeh.js if you need to dig in deep.
And as the project matures - the number of reasons to jump from 1 to 2 to 3 will become less. I'd like to see a similar approach applied to general UI development. It's a great example of "make the easy things easy, and the hard things possible".
This is incredibly dismissive and hardly a well functioning argument. I don't like to edit html templates, therefor web frameworks shouldn't exist.
I'm somehow trying to solve this problem by using jinja2 macros to the point of abuse and by having relatively large amount of python code that handles generating complex HTML (navigation, tables, forms, widgets...).
for forms use https://github.com/gregmuellegger/django-floppyforms
For navigation just use something like http://purecss.io/menus/
Instead of the webapp-as-desktop-app does there exist a language/IDE/tool that has a friendlier license for building native desktop apps?
This sounds a lot like PyJS: http://pyjs.org/
Nowadays, I wouldn't consider pyjs to build anything relevant..
I see some pretty glaring reasons why Python has not taken off in writing GUIs, especially on mobile.
1. The Python runtime is not very easy to embed on iOS and Android, and the sheer number of bindings needed to make it worth doing is immense.
2. Python's runtime is completely and utterly incapable of threading. Threading being almost essential to any decent user interface, this whole idea falls flat.
3. If the other two problems weren't enough, Python's single-threaded performance is really not great either. On resource-constrained systems (think phones) this hits doubly hard.
This is just plain wrong and the fact that many GUI programs are written in Python (dropbox, NetworkManager, Zim desktop wiki, etc) should be evidence of that. In fact, most people don't even realize these are written in Python. Yes, Python has the GIL. No, that does not mean it can't do multithreading. It merely means it can't do parallel processing on multiple cores with just threading. But that is by no means a requirement for multithreading, especially regarding GUIs.
This simply isn't true. Python has the GIL, but that doesn't stop it from making use of threads for IO or CPU bound tasks that release the GIL (using extension modules). There are lots of libraries for multi-threaded IO in Python (e.g., gevent, Twisted, Tornado, asyncio), and, not surprisingly, they are very widely used for web programming.
While you're AFAIK correct about running Python on mobile devices, and I think anyone will admit that Python's performance has never been great, one can have a great UI without threads: use coroutines and channels instead.
Fortunately, Python does have coroutines, and a channel library can be built in the fashion of Lua's channel library (https://github.com/majek/lua-channels). I don't know if anyone has done it yet, I'll grant, but a cursory look suggests that it's possible.
The basic idea is that one would spawn a coroutine to handle each UI element, and the coroutines would send messages to one another on channels. I've no idea how fast it would be (at a guess: terrible), but it should work.
With regards to performance, I found that one can produce very fast routines through use of specialized libraries for specific tasks, such as numpy etc. There are also great visualization tools, such as pyqtgraph which are blazing fast, at least, in my view, compared to any web interface. I have been skeptical about the html/js interface so far, because I am concerned with how fast large amounts of data can be surfaced from Python data models to HTML plots.
That said, I share the Python UI pain :/ As of now, I am stuck with QT and cx_freeze for desktop app development and the whole thing feels very medieval. The QT library in itself is great but at the same time it does not feel very "python". cx_freeze requires constant tinkering and makes debugging very hard at times.
What do HN users use for building GUIs for Python? :)
The only platform where Python could flourish without effort was Maemo, and for the very brief time that project lived, it did exactly that.