In need of .NET advocacy

J

Jon Skeet [C# MVP]

Alex said:
Can you please suggest what is the preferred way of utilizing "using"
when one has several heterogeneous items to dispose?

Just nest them:

using (...)
{
using (...)
{
...
}
}

If you don't like the deep indentation, you can do:

using (...)
using (...)
using (...)
{
...
}

My main point, however, which you've snipped, is that automatic memory
management is a big win. The unmanaged resource management isn't that
hard with just a bit of discipline - which you need in C++ too...
 
S

Sean Hederman

Alex said:
On the "cons" side:
* Existing developers need retraining (time, money, "beginners' mistakes")

No formal case studies, but just my experience:
When we moved our workflow product team to .NET, we saw a 20-30% drop in
productivity. After about 2 months we were back to parity, and gradually
moved to 40-50% increased productivity 6 months later. Keep in mind that we
moved a disparate group, some VB6, some Delphi, some C++, but all fairly
senior.
 
A

Alex

Hello Sean,

Sean Hederman said:
No formal case studies, but just my experience:
When we moved our workflow product team to .NET, we saw a 20-30% drop in
productivity. After about 2 months we were back to parity, and gradually
moved to 40-50% increased productivity 6 months later. Keep in mind that we
moved a disparate group, some VB6, some Delphi, some C++, but all fairly
senior.

Good info, thanks!
 
A

Alex

Hello Jon,

Jon Skeet said:
Just nest them:
If you don't like the deep indentation, you can do:

using (...)
using (...)
using (...)
{
...
}

I guess that will have to do.

Thank you.
 
N

Nick Malik [Microsoft]

Hello Alex,

Perhaps this will help.
Slightly off - Canada, Ontario, Toronto area.









Microsoft Canada Co.
1950 Meadowvale Blvd
Mississauga, Ontario
L5N 8L9


Canadian Head Office: (905) 568-0434
Customer Inquiries: (877) 568-2495
Microsoft TT/TDD: (905) 568-9641
Microsoft Order Centre: (800) 933-4750



I don't know how far Mississauga is from your location (especially since I
don't know precisely where your location is :), but I'm sure that they will
be helpful. I've worked with the good folks in my local district office on
occasion over the years, and they are nothing if not helpful, fair, and
informative.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 
N

Nick Malik [Microsoft]

Hello Alex,
Why don't you tell me what design patterns the framework implements?

That's fair.

Unfortunately, it would be difficult to catalog all of the patterns, and
which framework item uses which pattern, without an extensive amount of time
dedicated to the topic. Cataloging would not prove very much, and isn't the
most interesting work (it's up there with counting spots on the backs of
insects... something that most of us are quite happy to let _other_ folks do
for us).

Clearly, the Observer pattern (and its cousin, the Event pattern) are
heavily used, as are the Factory Method, Builder, Iterator, Strategy and
Bridge.
I can make a case for Singleton as a supported pattern but I don't know
where the framework uses it.
I'm pretty sure that IClonable is essentially an implementation of the
Prototype pattern.
The XML classes use Composite quite a bit.
The IO classes make use of the Decorator pattern.
..Net Remoting and web services make heavy use of the Proxy pattern .
I could make a fairly strong case that Visitor and Adapter are used by the
data classes.

A page of articles on design patterns in .Net can be found here
http://www.windowsforms.net/Article...t=Design+Patterns&ModuleFilter=131&tabindex=3

A good site for sharing of design patterns can be found here
http://patternshare.org/default.aspx/Home.TableColumns

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 
O

Olaf Baeyens

As well can using the framework give you a very standarized UI. What
probably will save the client education time, for what he will be glad with.
I think that the UI is the first reason why people will start using the
..NET.
I do it too because I can create user interfaces very fast that are nice,
stable and very user friendly compared to the MFC way.
But when I need the raw processing power, most funtions are still
conventional C++.
What I do now is try to write unmanaged C++ in a .NET way, or at least close
to it, so that this part of the code is ready when I port it to the .NET way
of life. Especially using properties, using private as much as I can, and
use delegates/events as much as I can and avoid the SendMessage() way of
communicating.

I see that ATI have a .NET program to configure the their network card.

And I discovered Friday that Pincacle Studio 9 also uses the .NET framework,
and I think it is for their wizard.
 
O

Olaf Baeyens

Have some of the devs write a simple app in C#.
I am writing one as we speak.
Managed to convince the powers that be that a prototype shoud be throwaway
so it does not really matter if
I use a different technology.
Maybe a very good reason to use the .NET programs is use it as fast
prototyping tool to test new interfaces and code functionality.
Maybe this way they all get hooked by it in time when they discover how fast
you can produce code and that actually works.
Let me tell you, trying to beat the deadlines while learning a new
technology at the same time can be challenging...I know, one of the most interesting aspects of beeing a programmer. ;-)
Performing miracles. :)

You feel the adrealine rushing through your vanes, very addictive. :)
 
O

Olaf Baeyens

* Existing developers need retraining (time, money, "beginners' mistakes")
* Supporting yet another technology (old products WILL NOT be rewritten but still supported)
Although I am a big favour of .NET it has also cons sides.
And it would morally be not right if I would hide these negative sides.

* The resistance of people to install the .NET framework. You would not
believe what stories they come up in order not to install it. Typical would
be: It slows down my computer, It is too big, I don't believe in it,....
* At this moment installing the .NET framework is far too complicated. New
distributions of Windows XP seems to contain the .NET framework, but from
the summer on we will have a new one the v2.0. So I hope the installation
becomes a one click situation. The situation through critical updates is
currently too complicated for my grandmother that wants to browse the
Internet and read email.
* Installation is a bit complicated because of the security issuses if the
program needs internet and/or LAN access. Luckily this can be easily fixed
by creating a managed dll that contains registration code to give your
program enough access to access the LAN and Internet. You cannot grant
access rights from inside your program, but you can make the setup run that
managed code to give program user rights. The setup.exe is not a managed
code so it does have access to the user rights. And if people double click
on a setup then we assume that they know what they are doing.
* The resistance of the VB and C++ programers since they have to relearn
everything, becoming a newbie.
* The error reporting that would give a user a heart attack when something
goes wrong like no LAN access, or when you try to run the program from a
networkdrive by double clicking on it. You get an error like the "access
violation" type with a list of all assemblies loaded, where even normal
programmers have no idea what it all means. This is very user-unfriendly.

These are the ones that comes to my mind...

Especially the resistance to install the .NET framework by the users and the
resistance of older C++ programmers is the biggest hurdle to overcome in my
opinion. I classify this phonomenon as "The big scare". Scare of the unknown
because it is baseless.
Luckily time is in our favour here.
 
A

Alex

Hello Olaf,

Olaf Baeyens said:
Although I am a big favour of .NET it has also cons sides.
And it would morally be not right if I would hide these negative sides.

* The resistance of people to install the .NET framework. You would not
believe what stories they come up in order not to install it. Typical would
be: It slows down my computer, It is too big, I don't believe in it,....

Not an issue in our case.
The customer gets a "black box", they should not care if it uses the CLR, the JVM or P-Code...
* At this moment installing the .NET framework is far too complicated. New
distributions of Windows XP seems to contain the .NET framework, but from
the summer on we will have a new one the v2.0. So I hope the installation
becomes a one click situation. The situation through critical updates is
currently too complicated for my grandmother that wants to browse the
Internet and read email.

Did I mention that our company makes money on support as well? :)
* Installation is a bit complicated because of the security issuses if the
program needs internet and/or LAN access. Luckily this can be easily fixed
by creating a managed dll that contains registration code to give your
program enough access to access the LAN and Internet. You cannot grant
access rights from inside your program, but you can make the setup run that
managed code to give program user rights. The setup.exe is not a managed
code so it does have access to the user rights. And if people double click
on a setup then we assume that they know what they are doing.

Not relevant at this time but good to know.
* The resistance of the VB and C++ programers since they have to relearn
everything, becoming a newbie.

Nah, some our developers *want* to switch and the rest will be pigeonholed into maintaining old C++/COM/MFC/ATL code.
* The error reporting that would give a user a heart attack when something
goes wrong like no LAN access, or when you try to run the program from a
networkdrive by double clicking on it. You get an error like the "access
violation" type with a list of all assemblies loaded, where even normal
programmers have no idea what it all means. This is very user-unfriendly.

Looks like an uncaught exception to me (and we know what to do with those in any language).
These are the ones that comes to my mind...

So far, they all seem to have reasonable workarounds.

Best wishes,
Alex.
 
A

Alex

Hello Nick,

Nick Malik said:
Hello Alex,

Perhaps this will help.

Microsoft Canada Co.
1950 Meadowvale Blvd
Mississauga, Ontario
L5N 8L9

Canadian Head Office: (905) 568-0434
Customer Inquiries: (877) 568-2495
Microsoft TT/TDD: (905) 568-9641
Microsoft Order Centre: (800) 933-4750



I don't know how far Mississauga is from your location (especially since I
don't know precisely where your location is :), but I'm sure that they will
be helpful. I've worked with the good folks in my local district office on
occasion over the years, and they are nothing if not helpful, fair, and
informative.

Thanks, I am already communicating with Ryan Storgaard (http://blogs.msdn.com/stoey) on this subject.
His last update was that he got some people in Redmond digging for info and he'll let me know when anything happens.

Best wishes,
Alex.
 
A

Alex

Hello Nick,

Nick Malik said:
Clearly, the Observer pattern (and its cousin, the Event pattern) are
heavily used, as are the Factory Method, Builder, Iterator, Strategy and
Bridge.
I can make a case for Singleton as a supported pattern but I don't know
where the framework uses it.
I'm pretty sure that IClonable is essentially an implementation of the
Prototype pattern.
The XML classes use Composite quite a bit.
The IO classes make use of the Decorator pattern.
.Net Remoting and web services make heavy use of the Proxy pattern .
I could make a fairly strong case that Visitor and Adapter are used by the
data classes.

A page of articles on design patterns in .Net can be found here
http://www.windowsforms.net/Article...t=Design+Patterns&ModuleFilter=131&tabindex=3

Thanks.

I am yet unfamiliar with most of the framework parts that you mentioned, that's why I asked.

As an aside, I think of design patterns as mostly documentation aids.
Most (if not all) SW design patterns boil down to adding an extra level of indirection.
However, knowing a commonly used name for it saves us from lengthy explanation where and how it is added. :)

Best wishes,
Alex.
 
A

Alex

Olaf Baeyens said:
But when I need the raw processing power, most funtions are still
conventional C++.

I wrote some embedded C++ for ECI telecom some time ago.
At the time, the hardware was not powerful enough to run a virtual machine with the required performance for the given price.
Now, I don't know...
I see that ATI have a .NET program to configure the their network card.

I can only say good for them!
(My previous job was with ATI, maintaining and enhancing HydraVision, so I know what I'm talking about).

Hmmm... Network card???
 
O

Olaf Baeyens

I can only say good for them!
(My previous job was with ATI, maintaining and enhancing HydraVision, so I know what I'm talking about).

Hmmm... Network card???
Oops video card, not network card. Sorry....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top