5 ms·
Qt has shaped up to be such an attractive, pleasant-to-use framework. QML has turned out quite convenient, too. It's a pity that Qt's foundation remains a fun
by jnbiche 13y ago
Qt has shaped up to be such an attractive, pleasant-to-use framework. QML has turned out quite convenient, too. It's a pity that Qt's foundation remains a fundamentally memory-unsafe language like C++.
I'm using a lot of languages now that offer significantly more safety, both memory and type (including OCaml, Golang, and playing with Rust).
Even with the very welcome additions of C++11/14, it still seems like I'm stepping back into a previous era when I write C++. I use C occasionally, but when I do I know I'm manipulating memory directly, and if I'm not careful it can bite me. C++ has adopted so many modern language features that it's easy to forget it shares many of the same attributes as C, even if most of them are now avoidable with care and attention.
One nice response to this dilemma is Niemeyer's go-qml (sponsored by Ubuntu, if I'm not mistaken). go-qml allows you to create your main Qt program in Go, leaving QML for the layout only. So no C++ at all (except under the covers, of course). I look forward to seeing how go-qml evolves [1].
1. https://github.com/go-qml/qml https://github.com/go-qml/qml
- flohofwoe 13y agoQt has a very friendly high-level C++ style though, which makes it hard to create memory errors (unless one insists on working with raw pointers and C-style arrays), and the code is pleasant to look at and read (IMHO of course). It's also a great multi-platform framework beyond pure UI stuff.
- jnbiche 13y agoI agree completely. Qt makes C++ a relative pleasure to use. I'm only speaking to the memory safety of the language.
- cheez 13y ago> It's a pity that Qt's foundation remains a fundamentally memory-unsafe language like C++. <Groan> Come on. C++ takes 1 to 2 years tops to develop good habits provided you either read the effective C++ series or you have a good mentor. Just like any other language. What it sounds like you're saying is that programming languages should not require expertise. Maybe. It can be instructive to look at other engineering disciplines to see how much they rely on fundamental knowledge or how much their tools abstract for them to see how programming will go. That being said, I do (rarely) run into memory issues when it comes to threading but the last time I had a buffer overrun or anything of that sort was probably years ago. I reckon these threading bugs are easy to create with most languages, except maybe Go. When C++ adopts a proper module specification, my last complaint about it will be gone (compile times).
- AlexanderDhoore 13y agoOne or two years is a lot... Learning python took me a month, maybe. Learning C a few months. Learning Objective-C 3-4 months. Hell, I learned quite a bit of Erlang in two weeks during christmas. (Although I'm also a big believer in the "10,000-Hour Rule".) C++ is too complex/powerful.
- jnbiche 13y agoBingo. I've learned pretty fluent Go in the course of a month. I've been programming in C++ for years and still feel shaky sometimes.
- jnbiche 13y ago>C++ takes 1 to 2 years tops to develop good habits provided you either read the effective C++ series or you have a good mentor. Just like any other language. But it's really not like any other language. In most other modern languages, you can write relatively safe code while you're mastering it. You may write unidiomatic code as you're learning, but you're not going to leave integer overflows or (with some modern languages) null pointer errors throughout your code. So yes, I guess am saying programming languages should not require years of expertise. It's beneficial to have a Python or Go expert around, but you can write perfectly respectable code in these languages after a few weeks if you're an experienced programmer. Even in other paradigms like OCaml and Haskell, I see most skilled programmers picking up idiomatic usage after a few months. What's idiomatic C++? What's safe C++? It's hard to define, and it's a vast language. C and C++ are fine tools to use if you're already an expert (except for those pesky bugs that bring down Internet security). But for new language learners, there are thankfully a new wave of safe, type safe languages coming on board.
- cheez 13y agoC++03, sure, but not C++11. If any C++11 course begins with using raw pointers or arrays, they're doing the students a disservice. There are safe and unsafe parts of the language, the trick is when to use which. Go, Erlang, etc are all designed to be used for particular purposes. Go may break out of its box because it is a general purpose language, but its core use case is concurrency just like Erlang. I honestly doubt it will because its syntax is ugly, though not as fugly as C++ can be. I feel like the majority of C++ programmers would support gun ownership, which might say a lot.
- abdulhaq 13y agoPyQt for - you guessed it - python is a superb wrapper for Qt.
- jevinskie 13y agoAnd PySide if you want to avoid GPL! We are lucky to have two high-quality Python bindings into Qt. http://qt-project.org/wiki/PySide http://qt-project.org/wiki/PySide
- toyg 13y agoYou can also "avoid GPL" by paying Phil Thompson for the awesome work he does: http://www.riverbankcomputing.co.uk/commercial/buy http://www.riverbankcomputing.co.uk/commercial/buy (To clarify: PyQt commercial licenses are not GPL)
- jnbiche 13y agoI can certainly respect commercial software projects, and have no problem shelling out a few hundred for quality software that I'll use frequently. But $600 for a commercial license to the bindings of a open source graphics library is pretty excessive in my mind. Clearly, Riverbank is shooting for the enterprise users, and good for them if they're finding enterprise clients to pay that amount, but for independent software developers making small commercial products that might net a few thousand USD, that's too much. So it shouldn't be surprising that people are happy to have alternatives.
- photex 13y agoThe only shame with Qt and C++ is the difficulty of providing bindings for other languages. It's just such an immense set of libraries to wrap by hand. You also have to duplicate the work of moc.
- jnbiche 13y agoThis is an unfortunate reality for people building Qt bindings. I've always hoped that a coalition of Haskell, Nimrod, D, Rust, Lua, C#, Objective C, and other languages with easy C interop could come together and build a well-engineered C interface to Qt that was easy to maintain. There was QtC, but it fell apart a few years ago. There's also Smoke, but looking at an examples of its use[1], I can't help but think a well-designed C interface would be much easier to work with (disclaimer: I've never used Smoke). 1. http://techbase.kde.org/Development/Languages/Smoke http://techbase.kde.org/Development/Languages/Smoke