Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating com in c#

Status
Not open for further replies.

123ASP

MIS
Nov 2, 2002
239
US
I am reading that C# is a compiled language and it is the best language for developing web applications. I write classical asp where I put all my code in the body of the asp page. Then I leanred to put my code in vb com (dll) then call the com from within asp page. This makes my asp page much fater then what I used to do. Now with C#, since it is compiled code. I assume the aspx page will be fast and I do not need to put my code in com to make it faster. Any comments from Pros.
Thanks
Al
 
There are still valid programming reasons why you'd want to put the logic behind your application in another Assembly.

Note that I said Assembly, not COM module. In .NET you don't want to call any COM components unless you really have to. It's much faster to call another .NET Assembly than to go through the COM Interop layer.

The biggest reason to have your logic in another Assembly is to have it all in one place so that the business rules get used whether your users are using a web GUI or a web service, or some other communications technique that has yet to be invented (wireless?).

Also - less code means fewer bugs, so you don't want to have duplicate code in your code-behind pages all over the place. Put it in one place so you can call it as needed.

Chip H.
 
Thanks Chip for your input.
Since I have no clue what is .Net. I really do not know what Assembly means, but I guess it is a place where you put your business rules and logic instead of com in vb6.0

Now if I already have business rules in vb com. can I cut and past those rules from vb com to what you called Assembly , or there are alot of coding to make it work.

thanks
Al
 
Any compiled .NET project is an assembly. No matter if you do a library, an executable, a component, a web form or whatever you obtain an assembly.
Now I wouldn't use COM in .NET if I were you. You can still write components in .NET, but this is much much easier. On the other hand, the need for components is reduced because of the fact above: any compiled .NET file can be seen as an assembly. It is easier to access the members of an assembly specifically build as a library or as a component, but you can access the members of an assembly by using reflection even if it is not built for it.
I would stick to the libraries or components, if I were you, because it might be easier.
For more information about assemblies, check the assemblies overview topic at msdn online.
 
Thanks Alexboly for your calrification. I just started reading about vb 6 and com objects and I am not sure if I want to continue. It seems to me its going to be a waste of time to learn old stuff. What do you think, shall I quit vb6 com and learn vb.net or even C#.net
Your proffessional opinion is appreciated.
thanks
Al
 
If you don't have to learn COM for a certain purpose I would strongly advise you to pass to .NET.
It doesn't really matter if you learn C# or VB. Take the one that suits you best. All .NET languages use the same framework, so you can do exactly the same things in each of them (that is not fully true for Visual C++ .NET, but only for managed C++ code. However, if you write unmanaged C++ code, that's not really .NET programming, so...). You will see in examples that they are given usually in pairs: one for C# and one for VB, and the difference is not that big.
C# has one slight advantage: it has been written especially for the .NET framework. That means that it suits best the framework. I think though that it is a very slight advantage.
So, in my opinion, you should do the following things:
1) learn OOP principles (if you are not familiar with them already). All .NET languages are OOP, including VB;
2) read about the .NET framework;
3) learn C# or VB.NET syntax, grammar etc.
4) start playing around with what you learn. Read other forum topics, look on the web etc.

I hope this helps you.
 
Hi Alexboly,
Thanks for your feedback. I was not sure what route to take. 2 years I started reading about vb 6.0 and never worked with it as a proffessional career. I guess I have to concentrate of .Net thing and will take your advice and follow the steps you laid out.
regards
Al
 
123asp -
I went through the local Borders bookstore a couple of weekends ago, and there were only 8 books on the shelves that were about VB6. The rest were .NET. I've seen this before during the transition from VB5 to VB6. At this point, I'd say that VB6 only has 12 to 18 months left in it. I would spend my time learning .NET if I were you. :)

BTW, the short definition of an assembly is: "Unit of installation". In other words, an assembly is one or more DLLs or EXEs that get installed as a set. Most of the time an assembly will just be a single DLL or EXE, however.

Chip H.
 
chiph,
Guess what, Your input has fired me up and I already bought The complete C# Training Course, from Deitle, and will start next Monday. I guess for someone like me who does not have lot of experience under my belt, It would take me almost a year to become a Pro.
Thanks again for your insigth.
Regards,
Al
 
123ASP -

Like I've said before in this forum - the hard part is not learning the syntax of the C# language (you can just look that part up in the docs), but learning the FCL (framework class library).

In addition to your Deitle books, look for a copy of "C# in a nutshell" by O'Reilly (has some sort of bird on the cover). It covers the basics of the language, but most of it is a .NET Framework reference.

Chip H.
 
The question I have is will he be able to get all the .Net libraries exposed for an aspx application? If not, possibly he would have to make a com object in .Net anyways.
 
He shouldn't have any trouble using the .NET FCL, as the code-behind pages are .NET code just like anything else. This is assuming you don't try and do something odd like try writing a web page that is also a Windows Service. ;-)

There will always be design/architecture reasons for why you would do certain things in the .aspx page vs. doing them in a class library -- just like in any other application. My preference would be to do as little work as possible in the web pages (beyond data presentation & validation).

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top