5 ms·
C can be beautiful if you use it in the way it was intended. Code that mimics OO or functional patterns from other languages is certainly not.
by bluetomcat 10y ago
C can be beautiful if you use it in the way it was intended. Code that mimics OO or functional patterns from other languages is certainly not.
- jonathankoren 10y agoOh god, flashbacks to Gtk+, and it's "objected oriented C". C is the easiest to bind to, and anyway, C++ is just syntactic sugar! Now, let's define class by creating a struct that will hold your vtable and static properties, and another that will hold your instance data... Such bullshit.
- spriggan3 10y agoGtk+ is nice as long as you don't have to define your own classes with GObject . But in that case, there is Vala which compiles to C which makes more sense. To bad this project doesn't get more traction, it's actually well designed and the generated C code is quite readable. I personally prefer Vala to D from a design perspective.
- jonathankoren 10y agoI actually liked Gtk+ when I used it. It's layout managers were easy to use (if Java AWT like), and I rather liked playing with Glade and being able to use scripting languages to build apps. Alas, the greater GNOME attitudes that began to copy the worst aspects of Windows after the fateful (and correct) Sun Microsystems of user experience study in the late 90s of GNOME 1.x [0], which came back with "You literally have five different clocks, including one named 'Another Clock' [1], are asking people to identify video cards by chipset, and have odd settings that are explained solely by acronyms. Get your house in order." to then mean "No options at all!", and the bad copying of the worst ideas of windows to the bad copies of the worst ideas of Apple (e.g. undiscoverable keypresses and file choosers without directory path inputs) turned me off to the whole mess. [0] https://web.archive.org/web/20010725052737/http://developer.gnome.org/projects/gup/ut1_report/summary_recs.html https://web.archive.org/web/20010725052737/http://developer.... [1] http://www.linuxselfhelp.com/gnome/users-guide/clock-applets.html http://www.linuxselfhelp.com/gnome/users-guide/clock-applets...
- arethuza 10y agoWas Gtk+ a descendant of things like Xt Intrinsics? I seem to remember having to work with "object oriented C" in the mid '90s and not liking it at all.
- rhialto 10y agoI've looked somewhat at both, and my impression is that Gtk+ tried to do a similar thing as the Xt Intrinsics, but didn't do it in a really better way. The problem with both is that you still have to write a lot of boilerplate by hand. Of the Xt Intrinsics I know that the things you could do with it were pretty advanced for their time, just too much annoying work. What the Gtk+ people should have done is design some nice notation for objects and generate the Xt Intrinsics object boilerplate from that. Or in fact that should have been done soon after creating Xt.
- zump 10y agoC pet peeve: typedef structures for_incredibly_esoteric_type_t.
- bluetomcat 10y agoI too hate typedef except for integer/FP types where the new name would carry semantics, like, for example, `pid_t` or `time_t`. `point_t` instead of `struct point`, `color_t` instead of `enum color` or worse, `pint` instead of `int *` is stinky because it hides the actual operations which are only applicable to a struct, an enum, or a pointer, respectively.
- astrange 10y agoI've noticed a lot of people like to end their types in _t, maybe because it looks cool, but POSIX actually says all those names are reserved for the system. Oh well. http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2...
- noobermin 10y agoThe way it was intended? You mean by K&R? Seems like you are making a subjective judgement because I hardly doubt the majority of C hackers use C "as it was intended" in 1973. I'll postfix this by saying I actually don't consider the code snippet as ugly but that's because I like C. Most people consider C ugly because they use stuff like Python or C++ which hides some details. Macros can hide details too, they are just difficult to use. Therefore, for most people C will always be "ugly", but then again, beauty is in the eye of the beholder.