Programming Languages & How They Torment Me

  • (2 Pages)
  • +
  • 1
  • 2

19 Replies - 1581 Views - Last Post: 06 September 2012 - 03:17 PM

#1 pokiaka  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 76
  • Joined: 05-August 11

Programming Languages & How They Torment Me

Posted 06 September 2012 - 01:30 PM

Okay, this is an issue I've been having every now and then since I've been programming in C++ rather than C#; quite a long time:
Once I've tasted C++'s multiple inheritance, pointers, references, stack access and more, it was obvious that I never want to program in C# anymore, but something keeps bugging me:

All the great programming tools doesn't exist / behave correctly / is free to C++ programmers:
Refactoring, Auto-Complete / IntelliSense, UML Modeling (I've been watching C# guys "drawing" UML etc. and export it to code instantly.. it's RIDICULOUS! to add insult to injury they keep refactor the code from the UML!).
Furthermore, my only way to create a worthy program that includes a UI without paying A LOT of money is having an annoying Qt about-box.
(Not to mention that C++ don't have anything like .NET with so much tools and classes!)

So, to deal with the UI problem I thought maybe I'd code the logic in C++, and import the DLL to a C# application.
That's when I realized how slow and unpleasant InteropServices really is.
A friend of mine tried to import a C++-exported DLL with a function Add(int x, int y), and that "return x + y;" took nearly 5 seconds!

So I'm just torn apart:
One hand: C# doesn't have the power C++ has, and I also consider it RAM consuming.
Other hand: C++ doesn't have the (free) tools and libraries C# has, also the development of the language is really slow. "C++0x turned to C++0b" (A joke about that we're waiting so much time for C++11).

(I tried to check out C++/CLI until I found out Microsoft doesn't give a damn about it. not only they don't provide it anymore in Visual Studio 2012, in Visual Studio 2010 there was no IntelliSense)

What do you think I should do in order to code in an elegant free environment, with all the tools I'll need (like C#) and also able to access low-level operations (such as the one described at the top)?

This post has been edited by pokiaka: 06 September 2012 - 01:44 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Programming Languages & How They Torment Me

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,142
  • Joined: 12-June 08

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 01:37 PM

Quote

What do you think I should do? I really need help!

I would slow down and write a question.. I see huff.. I see puff.. I see some comparisons.. but not actual question. (outside of the one referencing the question not seen).

... do about *WHAT*?
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3169
  • View blog
  • Posts: 9,595
  • Joined: 05-May 12

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 01:42 PM

View Postpokiaka, on 06 September 2012 - 01:30 PM, said:

(I tried to check out C++/CLI until I found out Microsoft doesn't give a damn about it. not only they don't provide it anymore in Visual Studio 2012, in Visual Studio 2010 there was no IntelliSense)


A friend of mine, for some twisted reason, likes having all the WinForms controls but wants to write code in C++, so I try to help him along as best as I can. He was lamenting the lack of Intellisense for C++/CLI. I pointed him to Whole Tomato's Visual Assist and he's been a happy camper. Considering how stingy he is with money, he says that it's the best money he has ever spent on software over the 20 years he's been programming. http://www.wholetomato.com/

And it looks like they didn't take away C++/CLI. It's just that VS2012 doesn't let you create new apps using C++/CLI out of the box. You need to create your project in VS2010 and then import into VS2012. For more details see: http://stackoverflow...-studio-2012-rc

This post has been edited by Skydiver: 06 September 2012 - 01:49 PM

Was This Post Helpful? 0
  • +
  • -

#4 pokiaka  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 76
  • Joined: 05-August 11

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 01:47 PM

View Postmodi123_1, on 06 September 2012 - 01:37 PM, said:

Quote

What do you think I should do? I really need help!

I would slow down and write a question.. I see huff.. I see puff.. I see some comparisons.. but not actual question. (outside of the one referencing the question not seen).

... do about *WHAT*?


You're correct it wasn't clear enough, I've included this at the bottom:

Quote

What do you think I should do in order to code in an elegant free environment, with all the tools I'll need (like C#) and also able to access low-level operations (such as the one described at the top)?



View PostSkydiver, on 06 September 2012 - 01:42 PM, said:

View Postpokiaka, on 06 September 2012 - 01:30 PM, said:

(I tried to check out C++/CLI until I found out Microsoft doesn't give a damn about it. not only they don't provide it anymore in Visual Studio 2012, in Visual Studio 2010 there was no IntelliSense)


A friend of mine, for some twisted reason, likes having all the WinForms controls but wants to write code in C++, so I try to help him along as best as I can. He was lamenting the lack of Intellisense for C++/CLI. I pointed him to Whole Tomato's Visual Assist and he's been a happy camper. Considering how stingy he is with money, he says that it's the best money he has ever spent on software over the 20 years he's been programming. http://www.wholetomato.com/


Granted, but it costs a lot of money :(
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,142
  • Joined: 12-June 08

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 01:51 PM

What sort of low level operations are you talking about? You don't need to the "all or nothing" approach. Write your "low level" classes and what not in c++ and just run the dlls with all the gui and framework of C#.
Was This Post Helpful? 0
  • +
  • -

#6 pokiaka  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 76
  • Joined: 05-August 11

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 01:56 PM

View Postmodi123_1, on 06 September 2012 - 01:51 PM, said:

What sort of low level operations are you talking about? You don't need to the "all or nothing" approach. Write your "low level" classes and what not in c++ and just run the dlls with all the gui and framework of C#.


I'm talking about new & delete, and doing system-calls without killing the machine. (as they do with InteropServices, which I mentioned in the thread).

Even importing a C++ DLL would cause troubles, and very hard to write (re-declaring all the structs and functions, and whatnot.)

This post has been edited by pokiaka: 06 September 2012 - 02:00 PM

Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,142
  • Joined: 12-June 08

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 02:01 PM

Yeah.. the c++ would do those calls and the c# would just interact with the un-managaged c++ class.
Was This Post Helpful? 0
  • +
  • -

#8 pokiaka  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 76
  • Joined: 05-August 11

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 02:05 PM

View Postmodi123_1, on 06 September 2012 - 02:01 PM, said:

Yeah.. the c++ would do those calls and the c# would just interact with the un-managaged c++ class.


Yes but 2 problems rise:
1) Performance will absolutely suck.
2) You'll have to re-declare everything again in the C# code, like this:

[DllImport("MyDLL.dll")]
private static extern int func_1();

[DllImport("MyDLL.dll")]
private static extern int func_2();

[StructLayout(LayoutKind.Sequential)]
private struct STRUCT_DLL
{
    public Int32  int;
    public IntPtr intp;
}


(Not sure if this code is 100% correct but I know it's something like that)

This post has been edited by pokiaka: 06 September 2012 - 02:09 PM

Was This Post Helpful? 0
  • +
  • -

#9 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5316
  • View blog
  • Posts: 11,359
  • Joined: 02-June 10

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 02:11 PM

View Postpokiaka, on 06 September 2012 - 02:30 PM, said:

One hand: C# doesn't have the power C++ has

Not to mention that C++ don't have anything like .NET with so much tools and classes!


All the great programming tools don't exist / behave correctly / is free to C++ programmers:
Refactoring, Auto-Complete / IntelliSense, UML Modeling (I've been watching C# guys "drawing" UML etc. and export it to code instantly.. it's RIDICULOUS! to add insult to injury they keep refactor the code from the UML!).


Sure sounds like you're really saying "C++ doesn't have the available power that C# has."


View Postpokiaka, on 06 September 2012 - 02:30 PM, said:

Once I've tasted C++'s multiple inheritance, pointers, references, stack access and more

C# has refrences, pointers, you can access the stack, unsafe memory and {of a sort} multiple inheritence {through use of interfaces}

I would disagree on what you think your findings really are. You say that C++ is more powerful. Why? I consider being released from micromanaging the petty stuff so I can concentrate on the big picture to be pretty powerful. I don't want to have to manage the memory space of every tiny object instance I make: That's what Garbage Collection is for. If that was so darned powerful 20 years ago, then why do so many C++ programs have memory leaks? If all of that was so wonderful then why did hundreds of developers collaborate to improve on it creating C# (windows) and Objective-C (Mac)? Languages evolve to get past weaknesses.

Personally, I think you've just gotten caught up in the enthusiasm of your current professor for their chosen language.

Today's software development world moves FAST. If you want to have the 'power' to code every GUI control, every checkbox, every DropDownList, hand code every file copy function and screen drawing method - go for it. Personally, I want to get a complete program writen, debugged and out to market in 30 days or less, using all the available 'coolness' today's users expect. From Drag-n-drop to color-pulsing buttons, WPF control animations and self-resizing adjustment. People want their programs to look like 21st century applications. Unless you are building the 2% of applications that don't fall into today's normal world of desktop applications I just don't see how you can apply what you think of a 'more power in C++' to actually earning a living. What do you actually GAIN that makes up for everything you confess you loose by giving up WPF and all of the .NET framework?

As for the whole "I want to produce commercial-grade software but I think all the fabulous tools should be provided to me for free" attitude - Grow up. If you were a car mechanic you'd spend thousands on good tools. Photographers don't get free cameras given to them. Musicians by their own instruments. Quit whining and pay for your fraking development tools.
Was This Post Helpful? 1
  • +
  • -

#10 pokiaka  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 76
  • Joined: 05-August 11

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 02:32 PM

First, thank you very much, you're a major influence.
The issue remains because of the fact that I actually can go ahead and tell you why I think C++ is much more powerful. (and also the current professor is a Java guy -- I dislike Java on so many levels)

Why I dislike Garbage Collectors? I don't think they can be even able to do the job that a programmer will do.
I know RAM is considered cheap but that doesn't mean we should abuse it.
(Can you imagine an engine, or even a game programmed in C# except for some indie games?. I can't.)

Quote

why do so many C++ programs have memory leaks?


What non-sandbox C++ program memory leak?

Now to take care of the "Why is C++ much more powerful":

* No need for "hacks" for multiple inheritance (I'm constantly using this feature.)
* I control the GC. it doesn't have a mind of its own. If I want to delete, I delete!
* It's considered faster and I'm sure that's for a reason.
* I can write inline-assembly on hot-spots.
* I can make system-calls. today one of the 21st century applications (as you describe) is to have all those neat loading-bar at the Windows task-bar, and whatnot. (I mentioned time and time again why I think Interop-Services are horrible).

I just want to note, that even if I may seem stubborn, I don't mean to be.

This post has been edited by pokiaka: 06 September 2012 - 02:43 PM

Was This Post Helpful? 0
  • +
  • -

#11 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,142
  • Joined: 12-June 08

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 02:41 PM

There's no need to quote the bulk of the post right above yours..
Was This Post Helpful? 0
  • +
  • -

#12 pokiaka  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 76
  • Joined: 05-August 11

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 02:42 PM

View Postmodi123_1, on 06 September 2012 - 02:41 PM, said:

There's no need to quote the bulk of the post right above yours..


Didn't think it would bother anyone, but okay, I'll edit.
Was This Post Helpful? 0
  • +
  • -

#13 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,142
  • Joined: 12-June 08

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 02:46 PM

Wait - *why* are you using multiple inheritance? Typically, when I see multiple inheritance, it is just a bad design and solved by switching "is a" to "has a".
Was This Post Helpful? 1
  • +
  • -

#14 pokiaka  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 76
  • Joined: 05-August 11

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 02:50 PM

View Postmodi123_1, on 06 September 2012 - 02:46 PM, said:

Wait - *why* are you using multiple inheritance? Typically, when I see multiple inheritance, it is just a bad design and solved by switching "is a" to "has a".


Same reason you'd use multiple interfaces, only that I don't have to re-implement.
I never got the idea of interfaces. it's screaming "repeat your code for each class".

It makes it easy to add completely new functionality just by adding ": public MyClass".

This post has been edited by pokiaka: 06 September 2012 - 02:52 PM

Was This Post Helpful? 0
  • +
  • -

#15 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3169
  • View blog
  • Posts: 9,595
  • Joined: 05-May 12

Re: Programming Languages & How They Torment Me

Posted 06 September 2012 - 02:57 PM

The designers of C# had an option to support multiple inheritance, but relying on their years of experience chose not to. It's because over the years, the OO community has recognized that almost always, if you wanted to share functionality is better to prefer composition over inheritance. Here's a short article about it: http://www.artima.co.../compoinh3.html

Typically, when multiple inheritance is involved the goal is not to share functionality, but rather communicate multiple interfaces. Yes, multiple inheritance can be convenient at times, but in my experience it's also been the source of more headaches downstream than any of the convenience gained by writing a few lines of code less.
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2