Live data from Hacker News

Learn C

medium.com

161–170 of 182 posts

Re: Learn C

#161
post #121

Earlier quoted context omitted.

My parent's post said C was bad and software shouldn't be written in it. So I retort by talking about desktop software because this is an area where C and C++ rule supreme. I specified big because big software projects carry more merit. A calculator written in your favourite language might be pretty handy, but it doesn't show your language can be used for real software. I use some Python scripts, but I don't see it i…

Google Chrome is based on WebKit, which was based on KHTML, which has been around since 1998. Moreover, Chrome depends on system and external libraries that provide C/C++ headers. Any viable alternative would need to work with C/C++ headers without needing large amounts of glue code, which isn't necessarily easy. People still use C not because all of their code is so performance-sensitive that they can't deal with th…

WebKit might be C/C++, that doesn't mean the browser itself needs to be that way. So is Anki, for example, a Python program that works with the QT toolkit, which is C++.

But point taken. I'm not saying we should use C, I'm anxious to a future where other languages can be used for serious applications. I was just trying to show C cannot possibly be that bad, as is it is still, together with C++, choice number one for every desktop application (and is Objective-C counts, it also dominates the mobile market).

Re: Learn C

#162

Earlier quoted context omitted.

They took the code from the Ariane 4 and stuck it on the Ariane 5 assuming all would go fine. While a famous incident attributed to Ada, I can safely say that C and other popular languages have done far more damage. Even if not in terms of exploding rockets (I don't know), but time lost debugging, fiddling with checks that would be handled in other languages and so forth. I like to tell people with Ada I can spend my…

Is Ada worth learning?

It's a very personal decision. :) You're not going to be popular on HN with a language like Ada. You're also probably not going to find a company looking for Ada developers, though I, myself, do Ada work for pay.

The Ada way of doing things really is a whole other world with completely different goals in mind than what fanboys and fangirls (I'm using the term dismissively, but there are real problems with new languages) will tell you about the new language they're using that was thrown together last weekend. Ada, of course, is far from perfect, but the blemishes like unbounded string syntax (I hope to see that fixed next revision! Ada just had a new revision!) are not enough to put me off from all the safety and checking the language does for me.

I must tell you that it was the winner of a DoD contest to create a kind of perfect language. There was a document called the Steelman that outlined everything the DoD's perfectly readable, maintainable, reliable, safe language would look like. Three of the four entries were Pascal-derived, not C!

If there is one thing Ada will do for you, if you let it, is demolish your ego. Every stupid thing you do will be caught by the compiler and you will scorned. The compiler will piss and moan catch all sorts of fantastic errors that you'd have to pop into a debugger for in C. Some folks have this notion that they are infallible, but "to err is human", right? You're welcome to turn off the checks in specific instances or project-wide (if you're nuts), but this isn't me. I'd love to think it is—and I write pretty great Ada these days—and I still don't have the gaul to turn off compiler checks.

Everything isn't a pointer in Ada, we can nest functions. Hell we nest packages and do sorts of things that just don't translate to Java, C++ or C, but now I'm just rambling.

I think Ada is a great choice for anything more than a shell script. Learning it introduces you more to a software engineering mindset because the language is built for software engineering, not hacking something together— though, in time, you will be capable of it. It's not the change of mindset like switching from procedural to functional, but it may be just as enlightening.

Re: Learn C

#163
post #98

Earlier quoted context omitted.

What a victim complex. If someone is debating that we should stop using C, and I ask for software not written in C, it's obvious that I'm looking for contemporary software. And the reasoning that every software is "C" because it needs to do system/library calls would be ludicrous, and to provisionally accusing me of that is insulting. I've done some research myself, and there are some interesting and big projects in…

My impression is that desktop software is/was largely written in C/C++/C#/Objective C/Objective C++ because those are the languages to which the Operating Systems of today expose their APIs. For example Win32 = C/C++, Cocoa = Objective C, Metro = C# (or I guess anything compiled to the Common Intermediate Language (CIL)???). Now that said, most languages provide a bridging layer that allows them to call out to those…

Metro is an updated version of COM.

On the desktop side, you have C++/CX which is C++ with some language extensions to make talking to COM easier.

For those that would rather use plain ISO C++, there is the Windows Runtime template framework.

.NET code is JITed or compiled AOT with NGEN and makes use of CCW to interop with WinRT.

http://msdn.microsoft.com/de-de/magazine/jj651569.aspx

On the mobile side, Windows Phone 8 only has native applications, even .NET gets compiled to native code.

http://channel9.msdn.com/Shows/Going+Deep/Mani-Ramaswamy-and...

Re: Learn C

#164

Earlier quoted context omitted.

Is Ada worth learning?

It's a very personal decision. :) You're not going to be popular on HN with a language like Ada. You're also probably not going to find a company looking for Ada developers, though I, myself, do Ada work for pay. The Ada way of doing things really is a whole other world with completely different goals in mind than what fanboys and fangirls (I'm using the term dismissively, but there are real problems with new languag…

Once I read a story about a hardcore C developer that was forced to work on an Ada project.

In the beginning she was complaining a lot about the language's verbosity, but with the time she spent on the project she eventually became an Ada advocate! :)

Re: Learn C

#165
post #126

Earlier quoted context omitted.

I thought Bingo Card Creator was a Ruby on Rails app...

That's the webapp. The original software is a desktop version, and patio11 wrote it in Java as far as I know. http://www.kalzumeus.com/2006/06/28/the-sorrows-of-java-prin...

The desktop client is indeed written in Java Swing. Fun fact: for PDF printing and getting updates, it actually does interact with a web service in the Ruby on Rails application. Both are ungodly bits of code put together years ago which shame me but seem to continue functioning.

Re: Learn C

#166
post #161

Earlier quoted context omitted.

Google Chrome is based on WebKit, which was based on KHTML, which has been around since 1998. Moreover, Chrome depends on system and external libraries that provide C/C++ headers. Any viable alternative would need to work with C/C++ headers without needing large amounts of glue code, which isn't necessarily easy. People still use C not because all of their code is so performance-sensitive that they can't deal with th…

WebKit might be C/C++, that doesn't mean the browser itself needs to be that way. So is Anki, for example, a Python program that works with the QT toolkit, which is C++. But point taken. I'm not saying we should use C, I'm anxious to a future where other languages can be used for serious applications. I was just trying to show C cannot possibly be that bad, as is it is still, together with C++, choice number one for…

My point in all this has been that language popularity is nearly orthogonal to technical pros/cons. Languages become popular for non-technical reasons. The popularity of C, C++, Objective-C, and related languages has almost nothing to do with the technical features of those languages, and almost everything to do with the marketing of popular OSes: Unix, Windows, and iOS. If an OS written in ML had become dominant in the 80s or 90s, it is nearly certain that ML would be a popular language. The inertia created by this large ecosystem cannot be denied; it is part of the reason you keep seeing new software being written in C/C++.

C absolutely is that bad. It is poorly defined. It forces programmers to explicitly write out things that can and should be done automatically. There is no standard error-handling system, just conventions involving return values and global error flags; there is no error-recovery system at all. Something as seemingly simple as computing the average of two signed integers winds up being non-trivial. C++ is even worse, as not only does it inherit most of the problems with C, but it introduces an entirely new list of pointless problems. Debugging code written in these languages is needlessly difficult -- you are spending as much time on high-level problems (i.e. design problems) as you are on tracing pointers and figuring out where some uninitialized value became a problem. It is not unreasonable to estimate that the dominance of C and C++ carry the cost of billions of dollars spent dealing with the headaches caused by these languages' problems.

It is hard to come up with a list of technical advantages to counter the above. C has few features, and those features are not very powerful. All that C really has going for it is that you can be "close to the machine," though it should be clear that other languages let you do this too (since other languages have been used to implement entire OSes). C++ has a few technical features that may be advantageous -- but they all compose poorly with each other, and their value is weighed down by all the baggage C++ carried from C (and indeed, most of the really bizarre bugs you can make in C++ stem from this baggage).

The non-technical reasons for C being popular vastly outweigh the technical deficiency of the language. The reason C/C++ is "choice number one" for desktop software is almost entirely a result of those non-technical reasons.

Re: Learn C

#167
post #89

Earlier quoted context omitted.

I do not understand the hype around clojure. I think functional programming languages have mainly evolved to introduce stronger typing and to remove the parenthesis. I wish a great future to scala (and haskell). For me, clojure is outdated.

I suppose it's because functional programming isn't a one-trick shop. There is a paradigm that comes out of lisp macros that can't be accomplished within a language like Scala or Haskell, even though those languages are superior in many other respects.

scala has also macros since 2.10.0 : http://scalamacros.org/

Is there something special in clojure macros ?

Re: Learn C

#168
post #133

Earlier quoted context omitted.

I guess I don't see a strong distinction (or see them on the same axis) because I like the preprocessor and use it when I feel it's useful, but I still write fairly OOP-like public interfaces to my code.

I guess I'm not sure what you mean by "fairly OOP-like public interfaces". My strong suspicion is that you're referring to features that were standard in imperative programs prior to OOP becoming popular. For instance structs in C are functionally equivalent to records in Pascal which date back at least to ALGOL W in 1966. By contrast the earliest OO language is Simula 67 which came out a year later. If so, then I di…

If the same ideas of OOP have been around longer than the term itself (and I do believe you are right in pointing this out), do they cease to be the same ideas? This to me is degrading into a "tomato, tomato" discussion.

Reminds me of arguments I used to get into with a friend. My friend was really into naming patterns and stuff. I really disliked that, and thought to give it a technobabble-ish name distances the practice from the concept itself, which is usually more straightforward than the name suggests. I don't think your comment is the first thing I've read that steers me in the direction of "OOP as a buzzwordy name for preexisting, good, clean practices".

Re: Learn C

#169
post #164

Earlier quoted context omitted.

It's a very personal decision. :) You're not going to be popular on HN with a language like Ada. You're also probably not going to find a company looking for Ada developers, though I, myself, do Ada work for pay. The Ada way of doing things really is a whole other world with completely different goals in mind than what fanboys and fangirls (I'm using the term dismissively, but there are real problems with new languag…

Once I read a story about a hardcore C developer that was forced to work on an Ada project. In the beginning she was complaining a lot about the language's verbosity, but with the time she spent on the project she eventually became an Ada advocate! :)

That's a great anecdote. All to often you find when people are forced to do something they hate it no matter what, whether it's deserved or not. I'm guilty of this a bit myself. Ada had a DoD mandate in the 90s which really riled a lot of folks and put them off of the language for good. It's part of the reason Ada has not had more of an impact in our lives. That, and compilers for Ada were much more expensive then as well. For many many years though we've had GNAT, a free software project and GCC frontend. We are truly lucky to have it developed by it's corporate steward which is funded by dual-licensing the compiler for FLOSS and commercial support contracts.

Re: Learn C

#170

Earlier quoted context omitted.

I suppose it's because functional programming isn't a one-trick shop. There is a paradigm that comes out of lisp macros that can't be accomplished within a language like Scala or Haskell, even though those languages are superior in many other respects.

scala has also macros since 2.10.0 : http://scalamacros.org/ Is there something special in clojure macros ?

Clojure macros were designed in from the beginning, and thus a significant portion of Clojure core is built using macros. Also, to repeat an oft-stated argument, Clojure is homoiconic, making it much easier to treat code as data, and data as code, which dovetails quite nicely with the macro system.
Post reply on HN