Pages

Showing posts with label love. Show all posts
Showing posts with label love. Show all posts

Monday, July 3, 2017

The miracle of C




It is not fashionable to love the C language. Not like, but love. Time moves on and glorifying something from the seventies seems idiotic. But let us use a standard historian's trick: take C away and see what changes.

What would systems programmers use? FORTRAN? Assembly language? Pascal?

We would not have Java with the current syntax or semantics, no dotNet beyond Visual Basic, no browsers, no TCP/IP, no proliferation of language wars, and no C++.

LISP may have evolved to be more widely usable, and Pascal would have likely gained some practicality, at least proper initializers and scoping, and maybe modularity. FORTRAN would have remained dominant. We would still have APL, it was miraculously written in 360 assembler.

Oh yes, JavaScript would be LISP.  Git would be an unrealized dream, as would Lua and LabVIEW and probably MatLab.

Maybe evolution would have found a way, and maybe the down side of C's flexibility and power is fertility. It is an engine of change.

C is attributed to Dennis Ritchie, but its precursor, B, which has an almost identical syntax is pure Ken Thompson. It is this syntax that is so compelling. It is the closest thing to the thought process of a programmer. I would rather write in C than in anything else, and I am confused by those that thought that something like awk of sh were even necessary to make scripting easier. I can do most of it faster in C. And please do not bring up Perl.

C is compact, and it is complete and orthogonal and close to damn perfect. Arrays, pointers, and increments all mesh, probably thanks to Ritchie's semantics.

C is not a glorified assembly language, it is the centre of computer languages, instruction sets have evolved because of it. It distilled all that one needs or wants to do with a CPU.

Objects and user interaction are layers that can easily be added, and C has no trouble with these things, it can stretch.

Many say one can get hurt by its lack of constraint, but I find I get much more hurt by a lack of elegance and clarity in other languages, I sometimes feel like the ugliness of a language can hinder expression, or at least confuse it, and waste programmer's time.

I use C to develop algorithms that I sometimes need to implement in other languages, because it helps to reduce notational ambiguity. It is also universal. In that sense it is a kind of mathematics. Ken Thompson holds a very mathematical view of computing, in a good pragmatic sense, this is the guy who implemented regular expressions, who writes papers that are a joy to read, and who seems to think in a bottom-up clear way. Because of this, I think of him as a founding father of modern computer languages, he took Algol and its kin and made a definitive contribution.

C++ is not an improvement, it is a shameful opportunistic perversion. I use it because it has C in it, and luckily it remains compatible, and its flaws have inspired improvements, like Go. Even C# is a blessing compared to it. Bjarne's complaints and justifications around the preprocessor are noise. The preprocessor in C is a wonderful tool, and used well it can make the language do anything and work anywhere. It is brilliant meta hack. A leap of inventiveness, and rather than dismiss it as a source of bugs, it should be entrenched. C++'s templates are good things, but please do not claim they came to be as replacement for the preprocessor. Without it C++ would not have come into being so quickly. That same preprocessor was used by Bjarne to implement C with classes before it became C++.

Linus is right to dislike C++, it is easy to mess up in it, simply because it hides stuff, and I mean encapsulate is a bad word sometimes. So is overloading if misused, and programmers are a conflicted bunch, they sometimes favour cleverness over communication. I know, I do it and then regret it when I read my code later.

On the other hand, I do the OOP thing, and I think it can help code maintenance and force teams to adhere to design intentions, however it can all be done in C, if you are familiar with its philosophy. One architect I worked with a long time ago would write .h files and pass them around to developer to flesh out into .c or .cpp files. Objects take this a bit further, but not much. The biggest benefit is when doing UI's and other repetitive verbose coding, or when you want to get rid of switch statements all over the code.


And yes, no C, no Unix, no Linux, no Web as we know it.

I am not slamming other languages, just trying to put C where it belongs, at the top (because it is bottom up :-), for its expressiveness, rigour, elegance and efficiency. Did I forget anything?

Sunday, July 27, 2014

Breakfast at Tiffany's and Kiss Kiss Bang Bang

It was 1961. Blake Edwards directs Audrey Hepburn who plays an American geisha based on a story by Truman Capote. For Hepburn, it is a defining role, for the other players, like George Peppard, Buddy Ebsen, and Martin Balsam, it would be one of their best roles before moving on to the new upcoming medium of TV.

Blake Edwards who had funny ideas about what is funny, had asked Mickey Rooney to pretend he was Japanese, created a typical surreal party scene, and later regretted and apologized for the former and repeated the latter with Peter Sellars playing an Indian gentleman in brown-face.

Detail from Dancer - copyright 2014 - A. Barake

Despite all the Hollywood crassness and foibles and the watering down of the very moving story, the movie is a classic, and is moving. Some scenes are exactly true to the book, and their power undiluted. The undercurrent of tragedy is always there, the sadness of men's lust for youth, the hurt of youth abused, and the exploitation that derives from these circumstances is played though the central character.

The pattern of a party girl that knows that sex is power yet that feels trapped by it and yearns for something more permanent than the puppet strings that the pull of Eros provides is classic. Marilyn's appeal comes from there. That Hepburn was able to transcend it while still providing the sadness is genius.

Kiss Kiss Bang Bang, although ostensibly playing with Chandler themes, does provide a nod to the same story (to be fair, so did Chandler in his own misogynistic way in "The Little Sister"). There is the sad back story of childhood abuse, and the party girl in Hollywood plot line, and the sympathetic "friend" who wants her but cannot "have" her.

The pattern of friendship that becomes love is a Hollywood staple, watered down in Doris Day - Rock Hudson movies, and used and abused even today. Kiss Kiss Bang Bang hints at it, but the boy and girl do not get together, the boy finally admits to not being good with girls. It plays all the cliches and then twists them into something that says "I know all about this bullshit".

Breakfast at Tiffany's could not do that. It was shot on a budget of $2.5 million and earned 15. Kiss Kiss Bang Bang was shot on a budget of $15M and made 16. Draw your own conclusions on what sells.






Thursday, October 18, 2012

Half-baked vs open to possibilities? A manifesto.

studio series A. Barake 2008

I like the unfinished.

Whether it be studies, sketches, snippets of songs, or first drafts.

They seem alive, they allow for the future.

The future that I can choose to defer, giving me the hope of potential, of life going on.

Half-baked means that dinner is coming.

I also like the fully realized. It is post-coital, closure, comfort, time for closing the eyes and savoring.

So what is left not to like in this spectrum?

The mediocre, the completed in haste, the delivered for money not love, the faked, the cliche , the pandering to mass appeal, the blue smoke sentimentality of bad films by Spielberg and his ilk.

Playing the devil's advocate, I can see that the charges of laziness and lack of discipline can be laid. Other lesser judgements could be "wishy-washy", indecisive, uncommitted.

Yes, all valid categories for this approach, but the Venn diagram is flawed. These are not super sets of the incomplete. The incomplete is the super set of the attributes I list, and of many others. The incomplete action is the existential act, the rest is just noise and judgement. Being incomplete may not lead to riches, mass appeal, or to classic status, but it can reflect life and happiness. Certainly for me.