473,779 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C++ vs. C# (new to windows programming)...

Hi!
After messing around for some time with Tcl/Tk and VBScript,
we've finally reached the point where we need to put some speed
into our applications.

So, our typical application looks like this.
We've got this huge CAD tool, called Mentor Expedition, which
understands VBScript and JScript and offer an ActiveX-Interface
for Automation.

What we typically do is we have an application Gui which is
separate from the tool (Tcl/Tk), then connects to the tool and
accesses Automation objects.
This incurs a big overhead and limits performance to about 100
calls per second. This is way to slow.

We then did a few VBscript components and let that Mentor-Tool
run those via VBscript. That got us quite a speedup for as long
as we limited ourselves to getting data and iterating over
collections.

Now we are at a point where the VBScript needs to do some "real"
calculations too, like geometric transformations .

Therefore we are thinking of introducing a new animal into our
language zoo for the real high speed stuff.

The idea is to put the performance critical parts into a COM
component or, in fact into anything that can be loaded via the VBscript
createobject call, gets the Handle of some big Automation object,
runs in-process, maybe does a bulk insert into an oracle database
on the side (using oracle ole db) and can return complex objects
back to VBScript, like dictionaries or other self defined collections.
We are not really interested in Gui's, more in building blocks.

I've got a bit of experience in C++ from about ten years ago
on Linux.

Right now I'm tending a bit towards C++ for the speed and the
deterministic destructor calls, but I am absolutely glueless about
Windows programming in general, except for VBScript command
line tools.

What would you suggest?

Lots of Greetings and Thanks!
Volker
Apr 26 '06 #1
10 2487
I've been using C++ for about 10 years (professionally ) and only
dabbled with C# when it first came out in 2000 but in the last year
I've moved completely over to .NET and C# at a new company. The only
exception is for the direct show aspect of our product since C++ is the
only viable interface for writing filters at this point.
With that being said there should be no reason why mathematical
operations in C++ should be any faster than in C# unless you are
somehow exploiting some mmx routines that C# *may* not support. The
issues you need to concern yourself with are the communications; making
a lot of consecutive remoting calls (cross process) will incur more
timing overhead than a straight C++ call but I don't know where it
stands in terms of a COM call (which is what you were using before).
In addition the interop calls that will be required to/from a non-.NET
application will incur some extra overhead.
Personally I would suggest trying C# vs. C++, especially if you're
not proficient with windows programming in C++. I've never been a
big fan of MFC and trying to traverse the on-line help to decipher the
organizational logic of winapi methods has driving me insane over the
years and forced me to resort to trial by error because it was easier
to figure out what I should *actually* pass to a method to make it do
what I want. It's such a hodge podge collection of methods and
overrides that has evolved over time that it would be a nightmare for a
new comer. With the .NET complete reorganization I often find that the
namespaces, objects and methods are completely intuitive and I don't
even have to look at the help I just use the intelligence to find the
methods by looking for names that I would have called them and then
look for the override that passes that parameters that make sense to
me.
I've noticed a very large boost in productivity since switching over
to mainly C#. When I re-visit the direct show filter graphs I'm
reminded of how much time I've spent, over the years, just dealing
with silly compilation and linking errors that I just don't see when
using C#. Our application has a constant communication a database and
with various hardware components over a tcp connection to monitor and
control a microscope. I haven't done a lot of testing on rigorous
computations, which I will need to perform in the future to for tasks
like automatically focusing, but I'm completely confident that I can
do everything I need to do in C#.

In summary, you may hit different performance issues with C# vs. C++
but there should be a solution in C# that achieves the desired
performance. In terms of a learning curve using C# will be at least an
order of power easier than C++ to produce and maintain viable code.
You should do diligence and prototype the anticipated interactions with
your application using a C# application and if you run into performance
issues there are plenty of google groups members that will probably
have good suggestions to solve them.

Side note:
When I first started using C# the non-deterministic destructors really
bothered me because I had grown accustomed to implementing solutions
using them like synchronization and opening files etc. It hasn't
taken me too long to get used to designing things a little differently
and utilizing try..catch..fin ally blocks a lot more or using
IDisposable.

Apr 26 '06 #2
I think you forgot to say something about reverse engeneering in C#! That's
one of the main points, why I can't decide between C# and C++.

Obfuscation helps you to "protect", but "real" obfuscation is very expencive
and a "normal" programmer can't buy such products. :-(
Apr 26 '06 #3
DHarry <DH****@discuss ions.microsoft. com> wrote:
I think you forgot to say something about reverse engeneering in C#! That's
one of the main points, why I can't decide between C# and C++.

Obfuscation helps you to "protect", but "real" obfuscation is very expencive
and a "normal" programmer can't buy such products. :-(


Does a normal programmer really need such a product though? See
http://www.pobox.com/~skeet/csharp/obfuscation.html

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 26 '06 #4
Ok.. No Obfuscation any more... :-)

.... but what's with the performance?

I wrote a simple hello world application in MFC (C++) and C# 2.0 and created
two exe files.

If I click on the mfc app, I see a windows in < 1 second.
The C# app windows is shown after 4 seconds.

I think thats anoher point.


Apr 26 '06 #5
DHarry <DH****@discuss ions.microsoft. com> wrote:
Ok.. No Obfuscation any more... :-)

... but what's with the performance?

I wrote a simple hello world application in MFC (C++) and C# 2.0 and created
two exe files.

If I click on the mfc app, I see a windows in < 1 second.
The C# app windows is shown after 4 seconds.

I think thats anoher point.


What exactly did your app look like? Here's a small C# "Hello world"
app:

using System;
using System.Windows. Forms;
using System.Drawing;

class Test
{
static void Main()
{
Form f = new Form();
Label l = new Label();
l.Text = "Hello, World!";
f.Size = new Size (100, 50);
l.Size = new Size (100, 50);
f.Controls.Add( l);
Application.Run (f);
}
}

That comes up pretty much instantly on my box. The very first time you
run a .NET app you may find it takes a little while to load while it
first loads the .NET assemblies off disk, but in that respect MFC is
effectively cheating, and the post-startup performance isn't nearly as
noticeably different.

Now, .NET apps certainly can be slower in UI terms than MFC apps due to
graphic card acceleration differences (I don't know enough on it to
comment properly), but it's not usually an issue IMO. Other performance
is much closer to being on a par with native code though.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 26 '06 #6
Is use the Wizard in VS 2005. I always take the wizard if I develop
applications.
Apr 26 '06 #7
DHarry <DH****@discuss ions.microsoft. com> wrote:
Is use the Wizard in VS 2005. I always take the wizard if I develop
applications.


Whereas I prefer to have applications which are readable, broken up
into logical blocks instead of one giant initialization method.

Now, did you try my example?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 26 '06 #8
Yes, I tried it. Less than 1 second
Apr 26 '06 #9
The first time an assembly is loaded (or code is actually executed) it
gets compiled to machine code so there is a first time startup delay.
You do have options to pre-compile everything to avoid this. For an
application that often starts and stops this is probably advisable but
for an application that is meant to run for a long period of time this
isn't as much of a issue.

Apr 27 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2601
by: Peter Åstrand | last post by:
There's a new PEP available: PEP 324: popen5 - New POSIX process module A copy is included below. Comments are appreciated. ---- PEP: 324 Title: popen5 - New POSIX process module
4
2431
by: Mark | last post by:
Hello. I am new to programming and Python and was wondering if someone could help get me started. I picked Python to start learning to prgram because of some things I have read about it (easy to learn, object oriented, clear syntax, etc...). Can anyone assist in getting me started with learning to program and Python? Recommended reading material? Online tutorials? Recommended development tools (wxpython, pythonwin, etc...)? I am a...
11
9271
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
2
2363
by: ZubZero | last post by:
Hello, i have to write a utility in c++ for windows 2k/XP. But i have 2 difficult problems. I asked many programmers i know, but none of them was able to tell me how i can do this. 1. I would like to disable a specific USB-port (not all ports, only one). I have a USB Cardreader with an integrated 7-port USB-Hub.
19
1465
by: adi | last post by:
Hello friend, I've recently joined this public group. I've done lots of C programming stuff during my engineering days but only on a CLI (Turbo-C/C++). Right now i'm focussed on GUI programming through C and also some bit on CGI. I've started reading materials relevant to it but i'd like to ask that is this group encourages such topics or do I've to subscribe to some other group specific to GUI programming in C. Help me out, friend! Also...
2
1313
by: jm | last post by:
I got the code below from the .NET SDK. I am still new to C# and I don't understand how the code works. And by that I mean I don't understand how the program knows to execute it. I can find no entry point besides main. I cannot find an event that calls the code. It is a simple GDI+ application. I just don't see how it ever executes. I need nothing about the code itself, just how the thing "turns on." I don't ever see OnPaint called...
9
1496
by: tjones | last post by:
Hi, I am guessing this is *THE* nntp newsgroup for C#? I was hoping someone could point me in the right direction. Id like to find employment in the IT industry as a programmer again. My background is a mix of programming and networking. I have fairly decent skills in C++, Java and ADA. I have been working as a network engineer on all flavours of windows, lots of unix, mssql, cisco and others. Currently finishing a master of science...
4
1780
by: Mike | last post by:
Hi, I am planning on purchasing VS2005 to learn C# very soon, and I need good book recommendations. I realize this is a question that may be asked a lot, but please consider my background: I have been a ClassicVB/ASP programmer for about 7 years. I have never done anything with .NET and only have a very basic understanding of the platform. Recently, I started working on a large JAVA project at my job (even though I have very little...
0
1349
by: Samineni | last post by:
Welcome to comp.lang.c++! Read this first. This post is intended to give the new reader an introduction to reading and posting in this newsgroup. We respectfully request that you read all the way through this post, as it helps make for a more pleasant and useful group for everyone. First of all, please keep in mind that comp.lang.c++ is a group for discussion of general issues of the C++ programming language, as defined by the
15
372
by: | last post by:
Just asking for some advice. I am a VS C++ developer. I develope using the WIN32 API, and frankly I love developing with C++. I do not program for MFC, MFC is pretty lame. In fact I have always steered clear of any managed code programming. However, I started messing with windows forms/.net and I really am liking it, for once managed code seems doable. Since I have a background with C++ I started developing windows forms with C++. However,...
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.