PDA

View Full Version : Programming Languages Debated


AnotherJake
2005.06.28, 05:30 AM
Then there is VS.NET. VS.NET is a pretty serious development tool...
...for Windows. Yuck! You knew that was coming ;)

Anyway, having paid for Metrowerk's IDE in the past, and been dealt their heavy-handed upgrade pricing later on, I can say that I'm not sorry to see them leave. I think their engineers are second to none, but their management is at best the last.

DavidJJ
2005.06.28, 01:45 PM
Overall, I'm fairly impressed with the .Net framework.

Ugh, shudders. Except I develop websites for a living and .NET will not write code that validates to XHTML strict, which is one of the only methods to make IE use the correct rendering engine to display CSS pages properly. You wouldn't believe the issues we have between the developers at the backend and the designers at the front. We create perfect cross-platform HTML/XHTML/CSS websites only to see them break when the .NET folks get involved. To me, .aspx = blech. :???:

BeyondCloister
2005.06.28, 02:02 PM
You just have to remember the sad fact with the .Net stuff:

It pays a lot more per hour than Mac development does.

funkboy
2005.06.28, 02:12 PM
Ugh, shudders. Except I develop websites for a living and .NET will not write code that validates to XHTML strict, which is one of the only methods to make IE use the correct rendering engine to display CSS pages properly. You wouldn't believe the issues we have between the developers at the backend and the designers at the front. We create perfect cross-platform HTML/XHTML/CSS websites only to see them break when the .NET folks get involved. To me, .aspx = blech. :???:

To me, .Net is mostly C# stuff, and not a whole lot of ASP. I let other people take care of the ASP.

Duane
2005.06.28, 09:10 PM
C# sucks. There's a reason it's only on DOS.

aarku
2005.06.28, 09:22 PM
C# sucks. There's a reason it's only on DOS.

Are you trolling? Serious and ignorant? Joking?

:???:

funkboy
2005.06.28, 09:23 PM
C# sucks. There's a reason it's only on DOS.

???

Visual Studio .Net is the development tool for Windows, and C# is one of the languages. C# is what many (dare I say most) future Windows applications will be written in... and also many Web Services and, as mentioned earlier, web pages by way of asp.net code-behind pages.

I am as fanatic a Mac evangelist as the next guy, but have you tried C#? I enjoy it.

OneSadCookie
2005.06.28, 09:24 PM
WTF, Ryan?

a) C# is available for Windows either via .NET or Mono, and for Linux and Mac OS X via Mono.
b) C# is a very nice language, substantially better than C++ or Java. I'm still undecided on C# vs. ObjC, each would seem to have their own benefits.

AnotherJake
2005.06.28, 10:21 PM
I do not know diddly-squat about C# but I've been seeing rumblings here and there about how much people like it, which has piqued my curiosity. Googling for it turns up massive results. I haven't the foggiest idea where to start, especially for Mac implementations. I only have a passing interest in it at this point, but does anybody have a favorite site to get some more info on it?

OneSadCookie
2005.06.28, 10:30 PM
http://go-mono.com/

There you can download the Mac package, which includes the compiler, runtime, and some simple examples. It also links to a bunch of other places with more info.

AnotherJake
2005.06.28, 11:00 PM
Perfect! Thank you.

funkboy
2005.06.28, 11:21 PM
I do not know diddly-squat about C# but I've been seeing rumblings here and there about how much people like it, which has piqued my curiosity.

I think most people are more impressed with the Visual Studio .Net development environment rather than simply C#. The VS.Net environment has all sorts of very useful shortcuts and debugging, as mentioned earlier.

Dan Potter
2005.06.29, 02:38 AM
b) C# is a very nice language, substantially better than C++ or Java. I'm still undecided on C# vs. ObjC, each would seem to have their own benefits.

We argue this one at work quite a bit. I don't think C# is better than C++, just fills a different niche. C++ is the mega-language that includes pretty much every language feature (if only by clumsy extension) and isn't a total master of any of them. C# is missing many features I consider extremely useful vs C++, like templates for metaprogramming (check out Boost some time... there's some *crazy* stuff in there). Templates in C++ are actually turing-complete and you can write programs that run in the compiler itself, e.g. printing all the prime numbers up to N as warning messages. :) RAII is also something that seems to be absent in pretty much every language except C++, and I find it to be pretty amazingly useful. C# is starting to go there with "using" but it's still not as nice and general.

I don't want to start a language war though, and I'm sure you know about all this stuff already. ;) Just in case anyone else doesn't know much about these things.

Link to the prime number computer thing:

http://photon.poly.edu/~hbr/cs903-F00/lib_design/notes/meta.html

AnotherJake
2005.06.29, 03:40 AM
RAII is also something that seems to be absent in pretty much every language except C++, and I find it to be pretty amazingly useful.

It *sounds* freakin' awesome, but please explain RAII further. I googled for it shortly and came up with gibberish on all the sites I visited. I only have so much patience to read CS ramblings, but I got the impression that RAII is some magical force that makes reserved memory automatically become un-reserved when it isn't needed anymore. This is apparently accomplished by the mere use of the RAII paradigm, which gives the CPU the power of E.S.P to know when a resource isn't needed anymore. Maybe I hit all the wrong links but whatever I scanned through only espoused the *idea* of RAII, and I was unable to discover the actual *mechanism* which makes it work.

OneSadCookie
2005.06.29, 04:20 AM
RAAI/RAII "Resource Acquisition as/is Initialization" is the idea that when an object is initialized it acquires resources, and when it is destroyed it releases those resources. That much is consistent across pretty much all designs in pretty much all object-oriented languages. What C++ takes further is automatic destruction of stack-allocated objects when they leave scope.

A quick example, in C, you've probably written code like this:

void foo()
{
// stuff
glPushMatrix();
// some GL calls
glPopMatrix();
// things
}

the push and pop have to be a matched pair, but as "some GL calls" gets longer, it gets hard to see that they're balanced, and very bad things happen if they're not. In addition, if you throw an exception out of "some GL calls", the PopMatrix will be missed, leaving GL in an invalid state.

With RAAI, you get something like this:

class MatrixPusher
{
public:
MatrixPusher() { glPushMatrix(); }
~MatrixPusher() { glPopMatrix(); }
};

void foo()
{
// stuff
{
MatrixPusher matrixPusher;
// some GL calls
}
// things
}

Due to C++'s scoping and construction/destruction rules, PushMatrix and PopMatrix are called at exactly the same times as they used to be. Now though, you can't forget the PopMatrix, and even if you throw an exception out of "some GL calls", the PopMatrix will still happen.

The same applies to any concept which has to happen in balanced pairs -- fopen/fclose, new/delete being common ones :)

AnotherJake
2005.06.29, 04:59 AM
Aha! I get it. Excellent example. I can see the self-protection aspect of it, but it seems like those old cartoons where the character ties string on their second finger to remember why they tied the string on their first finger, which was to remind them that they needed to remember something... If you can understand the concept of programming to watch your ass then you should be at the level where you don't program yourself into a corner to begin with. To understand that you're putting in ~MatrixPusher() { glPopMatrix(); } so that you should willfully ignore balancing out the call doesn't make programming any less complicated IMHO.

OneSadCookie
2005.06.29, 05:16 AM
Making your life easier is always worthwhile. Writing shorter code is always worthwhile. Compare the non-RAAI exception-safe code:

void foo()
{
// stuff
glPushMatrix();
try
{
// some GL calls
glPopMatrix();
}
catch (...)
{
glPopMatrix();
throw;
}
// things
}

..... is that right? I had to think really hard about it. The RAAI code, I just wrote, and I'm sure it's correct.

Nope, wasn't right. I forgot the "throw".

Dan Potter
2005.06.29, 12:22 PM
Yeah, the convenience is nice but the exception handling is the real killer.

Another place it's a total rear-saver is with locking primitives in threading. For example you can do something like this:


void foo() {
Lock lock(&mutex);
....
}


Where "Lock" is some class that takes a pointer to a mutex, locks it on construction, and unlocks it on destruction. There's no need to worry at that point if you accidentally didn't unlock the mutex. Though my OS instructor from college would probably also have said that you shouldn't write functions such that you have to worry, to begin with. ;) But it saves you trouble with exceptions there too.