7 ms·
"Part of how C++ is successful is that it retains C compatibility" I think Objective C is a better object oriented C than C++. It's simpler, makes a syntactic
by jimbokun 17y ago
"Part of how C++ is successful is that it retains C compatibility"
I think Objective C is a better object oriented C than C++. It's simpler, makes a syntactic distinction between message passing and "traditional" C, and has a more dynamic run time. I'm surprised no one else has brought up Objective C as a better solution to the "make C object oriented" problem.
- ilyak 17y agoIt looks like the only platform that had production-level ObjC library was NeXT/OS X.
- joe_the_user 17y agoRecently, I went from Ruby on Rails web programming to C++ w/Qt GUI programming. Using the C++ features that I choose, C++ is actually pretty fast to develop on... (I did MFC years ago and that was nasty but Rails internal code is also awful, with fifty-million separate classes just for exceptions). Aside from C compatibility, C++ also allows one to create simple structures and procedures when such simple beasts are appropriate. I currently suspect one should have either "full" object orientation plus weak typing OR weak object orientation plus strong typing. Strong typing plus full OO = Bondage and Discipline language, where the size of the code itself starts to really drag your development and debugging time down. While Ruby or Python allows compact but slow code, Java and C#, among other excesses, force one to create a full class for every two-field data-structure. Thus C++ is more compact than C# and Java and faster than Python and Ruby, winning for race for a desktop application language (oddly enough, desktop apps need a fast language because they must compensate for desktop windowing systems being more bloated and users expect more from their machine each). I'm sure Haskell or Lisp are excellent for some things but I don't think their paradigm is very compatible with GUI programming - I'd be interested if someone has a counter-example.
- Tuna-Fish 17y agoI just have to nitpick here: Strong typing is always a good feature, and weak typing is always a bad one. Now, whether the types should be dynamic or static, is entirely up to the situation and what kind of system you are building.
- jacquesm 17y agoHaskell is pretty theoretical, but on the lisp front I think AutoCad and Emacs more than qualify.
- crucini 17y agoAutoCAD is not written in Lisp. It has been written in several languages, including C. AutoLisp is just a thin scripting layer. See <a href="http://www.fourmilab.ch/autofile/www/autofile.html>the http://www.fourmilab.ch/autofile/www/autofile.html>the autodesk file</a>.
- jacquesm 17y agoThat 'thin' scripting layer has been used to program some pretty impressive stuff in the engineering and architectural world. Anyway, some more examples then: http://www.cliki.net/Application http://www.cliki.net/Application
- crucini 17y ago> That 'thin' scripting layer has been used to program some pretty impressive stuff in the engineering and architectural world. Yes, I've seen people work wonders with AutoLisp. There was - probably still is - an application used for designing clothes. The designer creates, I think, a "size 8" and a lisp script generates the other sizes. AutoLisp being lisp-like is really a happy accident. The Autodeskers chose Xlisp IIRC because it was free and embeddable. If they could have embedded a C-like language interpreter, they would have. In fact later, AutoDesk introduced other languages and tried to push users onto them. But AutoLisp already had huge momentum.
- barrkel 17y agoAt least C# doesn't require you to allocate a file for your class, and a simple two-field class should consume no more than 5 lines of code. And if you're willing to use a generic tuple type, you don't need to declare a class at all; just use Tuple<Foo,Bar> as needed.
- dmnd 17y agoOr just use an anonymous type: var simple = new { Field1 = "foo", Field2 = "bar" };
- gaius 17y agoStrong typing plus full OO = Bondage and Discipline language, where the size of the code itself starts to really drag your development and debugging time down You're missing a crucial part of the equation: type inference. OCaml does what you want :-)
- joe_the_user 17y agoSure, I just meant in the languages I've been using recently. I someone is coming up with a type-infering variant of Ruby called Juby which could do the trick once it is work. Now, has anyone coded a GUI with Ocaml?
- gaius 17y agoNot personally (still use Tcl/Tk) , but: http://coherentpdf.com/blog/?p=38 http://coherentpdf.com/blog/?p=38
- tptacek 17y agoObjective C is cleaner and much more fun to write in, but it's less accommodating than C++: * You have to actually run the dynamic runtime, which even OS X's XNU doesn't do. * The dynamic runtime also obscures what's going on with the hardware, which can be a problem in embedded environments. I like Objective C but it's always felt like voodoo to me. I'm always more comfortable in Ruby+C than I am in ObjC.