News for hackers. Stuff that matters.
Re:C++ in Coders at Work by jimbokun on Friday October 16, 2009 @02:28PM (#885907)
"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.

Re:C++ in Coders at Work by joe_the_user on Friday October 16, 2009 @03:00PM (#885971)
Recently, 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.

Re:C++ in Coders at Work by jacquesm on Friday October 16, 2009 @03:11PM (#885983)
Haskell is pretty theoretical, but on the lisp front I think AutoCad and Emacs more than qualify.
Re:C++ in Coders at Work by crucini on Friday October 16, 2009 @05:38PM (#886229)
AutoCAD 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 autodesk file</a>.

Re:C++ in Coders at Work by jacquesm on Friday October 16, 2009 @06:21PM (#886295)
That '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

Re:C++ in Coders at Work by crucini on Saturday October 17, 2009 @04:50PM (#887412)
> 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.

Re:C++ in Coders at Work by barrkel on Friday October 16, 2009 @04:24PM (#886111)
At 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.
Re:C++ in Coders at Work by dmnd on Saturday October 17, 2009 @04:16AM (#886769)
Or just use an anonymous type:

  var simple = new { Field1 = "foo", Field2 = "bar" };
Re:C++ in Coders at Work by gaius on Friday October 16, 2009 @04:43PM (#886135)
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

You're missing a crucial part of the equation: type inference. OCaml does what you want :-)

Re:C++ in Coders at Work by joe_the_user on Friday October 16, 2009 @07:49PM (#886381)
Sure, 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?

Re:C++ in Coders at Work by gaius on Saturday October 17, 2009 @03:04AM (#886722)
Not personally (still use Tcl/Tk) , but: http://coherentpdf.com/blog/?p=38
Re:C++ in Coders at Work by Tuna-Fish on Friday October 16, 2009 @09:02PM (#886466)
I 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.

Re:C++ in Coders at Work by tptacek on Friday October 16, 2009 @05:37PM (#886228)
Objective 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.

Re:C++ in Coders at Work by ilyak on Friday October 16, 2009 @02:30PM (#885909)
It looks like the only platform that had production-level ObjC library was NeXT/OS X.