Is anyone else excited about .NET?

HJB417

Senior member
Dec 31, 2000
763
0
0
I bought C++ .NET step by step last friday afternoon and I'm @ p. 380 or so and all I gotta say is .NET owns!. Garbage collection, the arrays are packed with built in methods to manipulate the array (sort, binary search, reverse), and there are dictionary, hashtables too. What really got me was the ease of use to create a simple window. I remember trying to do the same 2 years ago and it wasn't this easy, and it required more lines of code. but check it out.

Also remember, this is just 1 small aspect of C++.NET. There's more to .NET than below, much more
--------------------

__gc class MyEmptyWindow: public Form
{
public:
MyEmptyWindow(){}
};

int __stdcall WinMain()
{
Application::Run(new MyEmptyWindow());
return 0;
}

-------------

Ofcourse there's some includes you gotta add at the top

#include <mscorlib.dll> (require), #include <System.dll> (required), #include <System.Windows.Forms.dll> (requried so we can inherit the class "Form") and #include <System.Drawing.dll> (need this to add stuff like buttons, combo boxes, menus, etc).
And then you need to add namespaces, notice the same name convention is used for both DLL and namespace
using namespace System; using namespace System::Windows::Forms; using namespace System::Drawing;

and if you want to add stuff like radio buttons, text boxes, labels, etc.
you just create them as objects, so if you were to modify the constructor, you'd do

MyEmptyWindow()
{
Label* someLabel = new Label();
Button* someButton = new Button();
TextBox* txtbox = new TextBox();

and you assign them properties like this

someLabel->Text = "enter name here";
Button->Text = "Click Me";
txtbox-> Text = "hi";
and there are a lot of properties you can set;
->Size (to specify the how much space it takes); ->location (to specify where in your window you want it placed); and the list goes on

to make these controls appear on your window, you do a final call
Controls->Add(someLabel);
Controls->Add(someButton);
Controls->Add(txtbox);

then you gotta add them to a multicast delegate which is a managed c++ feature, but it basically tells the program what to do when an aevent such as a click, double click, mouse hover, or something occurs. but you need to make a function for each action, and it goes like this

someButton->Click += new EventHandler(this, &MyMyEmptyWindow::button_click);

what this does is, when someone clicks "someButton", a functcion named "button_click" located in the MyEmtpyWindow class will be executed. You use "this" as the 1st paramater becuase the function is located within the class. If you want to execute a function from another class, you have to access it through an object of that class. I think that's how your supposed to do it =/

anyways, so the function for "button_click" would look like this

void button_click(Object* pObj, EventArgs* pArgs)
{
if(pObj == someButton) MessageBox::Show("button click detected", "title of messgaebox goes here");
}

It receives an object and checks to see if, the object is "someButton", the object could be something else such as "someLabel" or "txtbox" depending on how you code it.

So is this cool or what? This is just 1 small aspect of .NET, but look at how simple it is to make a windows program. No consoles. Also, look at how the properties for each control have the same name as their equivalent in VB, Is this cool or is this cool. =)
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
The only thing I like about is that once Mono is working Windows.NET programs will run natively on Linux and I'll have no more need for Windows =)

Also all the GUI stuff you're talking about was mindlessly simple with Borland C++ Builder years ago.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126


<< Also all the GUI stuff you're talking about was mindlessly simple with Borland C++ Builder years ago. >>

or VB or VC++ with MFC. This sounds like a lot more work than creating an MFC dialog-only app and using the resource editor to drag/drop controls into the layout that you want.

Near term I'm most likely to use .Net on the server side not the client, to replace ASP and compiled VB & VC++ cgi-bin programs.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
or VB or VC++ with MFC. This sounds like a lot more work than creating an MFC dialog-only app and using the resource editor to drag/drop controls into the layout that you want.

VB doesn't count because, well because it's VB =)

VC++ lets you design the forms easily, but using the MFC is overly complicated, Borland C++ builder is tons simpler and works just as well, if not better.
 

manly

Lifer
Jan 25, 2000
12,624
3,411
136
Those who believe ".Net" apps will run under Mono have too much faith/trust in M$.

More correctly, you can only believe ECMA-standard C#/CLR apps will run under Mono (when it's done).

Here's an interesting Slashdot comment that details what I'm referring to. Of course, since it's Slashdot, take it with a few grains of salt.

As for C#/CLR itself, 95% of it is borrowed from Java (note Java borrowed extensively from C++ as well), so I'm not excited.

The only reason to get excited is all the MFC programmers of the world get a clean slate to work with. :)

Use .Net if you want to; but don't be misled on what Mono is for. It's an implementation of a solid development framework and CLR runtime for *nix systems, not a .Net compatible runtime environment.

However, if you develop a substantial VS.Net application that deploys correctly under Mono, feel free to correct me. :)
 

HJB417

Senior member
Dec 31, 2000
763
0
0
ya, I took a look at the slashdot thread. Interesting stuff. When I looked at the mono classes, It seemed they had the the most necessary classes, I'm sure it could handle my needs. But for complex applications, problems willl probably occur, How many classes does 1 need though =) I hope they get mono done soon though, it would be sweet to have 1 code work on both linux and windows.
And about borland, I never tried borland =/ I was trying MFC programming w/ VC6++ and I'm just comparing MFC to .NET.
 

manly

Lifer
Jan 25, 2000
12,624
3,411
136
HJB417,

It's not about how many classes Mono implements, but how many classes in .Net are proprietary Microsoft intellectual property that can't be implemented.

Microsoft standardized C# and the CLR to get good PR and to spite Sun (which withdrew Java standardization), not because it participates openly/fairly with other organizations.

For example, WinForms is proprietary to IE, and services riding on top of .Net such as Passport are proprietary as well.

Once you build a substantial VS.Net app that leverages M$ technology, for all practical matters, M$ expects you to deploy it to Windows .Net server. However, if you write a standard C# app, you can deploy it to Mono (or any CLR). Notice there's a subtle, but substantial difference between the two. If you read what Miguel D' Icaza (spelling?) writes about this, you'll see he could care less about .Net. He just wants to advance the state-of-the-art development framework for GNOME. Remember that right now, GNOME is built on a component-based C framework. He sees the standard .Net framework (i.e. C# + CLR) as a bold step forward in software development.

While I certainly can't doubt his technical expertise, I just see it as a nice clone job of Java technologies.

Interestingly though, some company (Halcyonsoft or something like that) has reportedly already developed a .Net compatibility layer that rides on top of Java/JVM/J2EE. From what I read, it's only about 3 MB of classes, which is pretty amazing. If this is true, it just goes to show how much of a clone job M$ did when "innovating" C# and the CLR.

Just remember that M$ would never cede control of any technology it created/bought/embraced/extended, and so it's using ECMA standardization to win PR points. You have to hand it to them for having the industry's most-effective marketing department.

.Net will be a strong success for Winblows developers, but I suspect the vast majority of Java developers won't be fooled by the marketing blitz. Not to suggest .Net developers are fools either; they know what's better than MFC. ;)
 

Turkey

Senior member
Jan 10, 2000
839
0
0
So what you're saying is C++.NET is totally object oriented... like Java? And the applications will be able to run well on one platform and sort of well on another platform, assuming that it works at all? Kind of like Java? And the runtime environment will have garbage collection? You mean, like Java? So we're basically getting new technology that's about 5 years old?

Note: I realize there's more to .NET than just the languages and runtime environment, but it's not worth getting excited over.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Everyone knows C# takes a lot from Java, but .NET isn't just C#. Supposedly there will be compilers for many languages so you can use VB.NET, VC++.NET, C#, whatever language you want as long as it has something to compile it for the CLR.
 

HJB417

Senior member
Dec 31, 2000
763
0
0
well, the ease of use is what excites me, even though it isn't cross platform, doesn't bother me because I don't use a Unix type OS. From a windows programmer's point of viewer, .NET will make it simpler to create windows apps. Java does own because of it's cross platform ability and I will (hopefully) learn java sometime late this year. I also don't think it's fair that your comparing "managed c++" to java.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
well, the ease of use is what excites me, even though it isn't cross platform, doesn't bother me because I don't use a Unix type OS

Thanks for thinking of other people...

From a windows programmer's point of viewer, .NET will make it simpler to create windows apps.

You never used Borland C++ Builder did you? Like I said, it makes GUI apps as easily as VB, only you get to use C++ instead.

I also don't think it's fair that your comparing "managed c++" to java.

Why not? Java takes a lot from C++ and C# takes a lot from Java.
 

PCHPlayer

Golden Member
Oct 9, 2001
1,053
0
0
Once again it looks like microsoft has missed the OO boat. Here is sample Java program that does what the orginal post describes. Which one is more OO and easier to read? The syntax label->Text = "some text" is completely non-OO. It should have been label->setText("some text"). And passing pointers to functions... How antiquated. If the rest of C++.NET is like this example it is just another crap API from MS. It's too bad they didn't borrow a bit more from Java!

I wrote this code in about 2 minutes so no comments please.

import javax.swing.*

public class MyProgram implements ActionListener
{
public static void main(String[] args)
{
JLabel someLabel = new JLabel("Click me");
JButton someButton = new JButton("hi");
someButton.setActionCommand("hi");
JTextArea txtBox = new JTextArea();

JPanel panel = new JPanel();
panel.add(someLabel);
panel.add(someButton);
panel.add(txtBox);

someButton.addActionListener(this);

JFrame frame = new JFrame();
frame.getContentPane().add(panel);
frame.pack();
frame.show();
}

public void actionPerformed(ActionEvent evt)
{
if (evt.getActionCommand().equals("hi)) {
OptionPane.showDialog("Button clicked");
}
}
}
 

BuckleDownBen

Banned
Jun 11, 2001
519
0
0
Dotnet is significantly faster than Java. Plus, Visual Studio.net is a better IDE than anything I've seen for Java. Microsoft has a history of winning these battles. I expect they'll win the battle with Java too.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
The syntax label->Text = "some text" is completely non-OO.

Maybe I'm naive but to me an object has properties and methods, or variables and functions, simply because MS' language uses object->property = "something" as opposed to object->setproperty("something") isn't a bad thing, why would you even think that makes it 'completely non-OO'?

And passing pointers to functions... How antiquated

pointers antiquated? Come on, you sound as bad as the people saying the CLI is archaic.

Microsoft has a history of winning these battles. I expect they'll win the battle with Java too.

Sadly, you're probably right, atleast on the client side. MS is still having major problems moving into the server arena, even with all the boot-camped paper MCSEs running around.
 

HJB417

Senior member
Dec 31, 2000
763
0
0
I'm sorry nothinman, I never had the opportunity to work w/ Borland =( But it's cool that there are good alternatives to VC++6. My school uses M$ compilers =( and it didn't help that I bought a book titiled "VC++6" =).

I've never seen Java code before, (never actively search for it) but it's cool to see that Java and Managed C++ are similar. Also, about this syntax Property -> Value issue, This is a new Microsoft feature, here's an example of how it works

__gc class MyClass
{
private:
Int32* SomeValue;
public:
MyClass(){SomeValue = new Int32;}
__property int32 get_newint(Int32 newVal){ SomeValue = newVal;}
__property void set_newint(){ return SomeValue;;}
};

ini Main()
{
MyClass* bob = new MyClass();
Int32 MyInt = 1;

becuase of the __property declaration, you can now do
bob->newint = MyInt // to set the value of SomeValue or
Int32* newVal = bob->newint // to retrive the value of SomeValue

It's the same thing as before, but it looks neater. And it kinda looks like VB now, even though it has the ->
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0


<< The syntax label->Text = "some text" is completely non-OO. It should have been label->setText("some text"). And passing pointers to functions... How antiquated. If the rest of C++.NET is like this example it is just another crap API from MS. It's too bad they didn't borrow a bit more from Java! >>



Are you really this obtuse? :) You do, of course, understand that properties is nothing more than syntactical sugar, right? Can you please tell me how you think a property assignment is non-OO?

I imagine you'll have no real response, which means we can ignore your posts and label it as the typical post from an anti-MS zealot. You should spend more time reading the facts and less time perpetuating such ignorance.

Thanks! :)
 

manly

Lifer
Jan 25, 2000
12,624
3,411
136
Nothinman,

Personally I disagree about the language neutrality issue. First off, for any project involving a development team, you don't want cowboys coding in the flavor of the month. Thankfully, a good team lead (or organization) would have coding standards to prevent this type of mistake.

Secondly, yes MSIL is more powerful than Java bytecode when it comes to supporting many languages. However, languages have to be shaped to fit into the CLS (common language spec). An oversimplication of this fact is to say that most .Net languages end up being equivalent to C# with different keywords. If that's the case, then why bother?

As a side-note, Java bytecode can also be targetted by other languages; but it just isn't a significant idea to promote. Here's a good balanced article that describes the language neutrality issue better than I can. Note I'm not saying Java is the only language you need to use; always use the best tool for the job. But in this case, all .Net language flavors are just syntactic variations of the same basic language. So it's not as great a concept as it's billed to be.

Another way of saying this is that for me, C# is the natural and de-facto standard language to target .Net/CLR. If you take a look at managed C++ syntax, it's piss ugly. As an aside, I happen to like standard C++ a lot. However, the mental burden programming in it is simply higher than that of Java. Today, productivity (which includes correctness) counts a lot.

--

As far as Swing is concerned, it's a beautiful programming model for GUI apps. Newbies can create simple Swing apps on the first try in minutes. Unfortunately, Swing apps have had performance problems, and they simply don't integrate into the native OS runtime cleanly enough. You want to be able to program cross-platform UIs, but you don't really want the UI to look out-of-place on each platform.

BuckledownBen's comment that .Net is significantly faster than Java sounds like FUD to me. .Net is new and untested. Show me some *real* indepedent benchmarks to back up statements like that.

--

Lastly, many of the "new" language features in C# (relative to Java) are just syntactic sugar (for example properties and boxing/unboxing). They could be added to Java in a heartbeat without redesign of the language, platform, or libraries.

In my technical opinion, one language feature that's wrong in C# is that all exceptions are unchecked. Exceptions are an important part of a method signature, and this decision is simply a bad choice because many programmers are lazy when it comes to error handling.

You want your compiler to aid you in writing error handling code if possible; not having to wait until runtime to debug all the exceptions thrown in code. Remember it's just not even possible to fully test any code, so the end result is that your customers (users) will be the ones to see obscure runtime exeptions thrown. This is a language "feature" that leads to poor software engineering.

Worse off, this feature can't be corrected without breaking legacy code. Now that .Net is released, it will be virtually impossible to change. This is the type of thing Bill Joy alluded to recently when he said Mickeysoft will run into serious problems when they try to boltstrap security onto their designs in the future, as opposed to at the beginning.

 

PCHPlayer

Golden Member
Oct 9, 2001
1,053
0
0
> Are you really this obtuse? You do, of course, understand that properties is nothing more than syntactical sugar, right? Can you please > tell me how you think a property assignment is non-OO?

> I imagine you'll have no real response, which means we can ignore your posts and label it as the typical post from an anti-MS zealot.
> You should spend more time reading the facts and less time perpetuating such ignorance.

I never made any claims of being an MS expert (which I am not). Giving direct access to members of a class is just plain wrong. Yes it is correct syntax, but not OO. Read Scott Meyers' books Effective C++ and More Effective C++. Perhaps I do not understand what a "property" is. Maybe you could explain it in C++ terms (Is it a public member, a method?).

I actually like MS in general, but I do think that their API's leave alot to be desired (Specifically MFC and Win32). I wish they would come out with a good API, or maybe I should just learn the bad ones and make a ton of money coding apps for people.

In response to the use of pointers. Once references were added to C++ the use of pointers should be minimized. Pointer arithmetic is difficult for most programmers and should be avoided. The only time pointers should be used is when the object can be NULL.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Personally I disagree about the language neutrality issue. First off, for any project involving a development team, you don't want cowboys coding in the flavor of the month. Thankfully, a good team lead (or organization) would have coding standards to prevent this type of mistake.

True, but it also means I can write a class in C++.NET and you can use it in your VB.NET program with no problems at all, it's not all about groups of people in the same place working on the same project.
 

calpha

Golden Member
Mar 7, 2001
1,287
0
0
Well, the one thing I do like about .net is that web serving pages are now compiled through the CLR, vs the vbscript (read, asp) compiled through IIS. I also like that you can now code your Web Pages in C#, and actually use more than a functional development model (as was all too common in ASP Pages without compentization)

I also don't like that if you use the .NET Gui to create your total web solution, it creates one helluva hacked up Javascript functions automatically. I'm one of those web developers that liked to code my ASP Pages in UltraEdit my COM+ pieces in C++ , and manually enter my HTML and Javascript as opposed to the GUI method by something like Interdev.

I also like the fact that you can take your classes for a windows GUI, and use the exact same code for a Windows Web Page.

I think the fact that they are making the CLR open to any language is more confusing. If you're going to go with Microsoft Products, then it makes sense to me that you would use the language they use to develop their next gen apps (C#). I personally don't see the point in using anything other than C#. It's what .NET is written in, so why go from there. You have to relearn the other languages any way if you've used them in versions prior to .NET.

Lastly, the easy integration of SOAP and XML into the .NET is a good thing, but I see the whole .NET model as being quite a hurdle for most development shops to undertake. I would venture to say that it will be a while (based on the learning curve that I've experienced) before a lot of companies are needing .NET. Plus, the whole SOFTWARE as a SERVICE thing really hasn't set well with me, and I can only wonder if M$ is moving to a point where we will one day have to pay per use on things like Office as the ultimate way to stop piracy.
 

HJB417

Senior member
Dec 31, 2000
763
0
0
I hate the software as a service too =(
but you know, microsoft sells code for a living and I guess they gotta do whatever it takes to stay alive these days. =/

I also like the points mentioned in above posts and the java comparisions. I did come across a java vs .net study but I have a feeling it might be bias. Its cool to see that people like the multilanguage support.



<< I also like the fact that you can take your classes for a windows GUI, and use the exact same code for a Windows Web Page. >>



Is this for C# only or can I use the code in the 1st post and make a window on a webpage out of it? If I can, please tell me how =)
 

manly

Lifer
Jan 25, 2000
12,624
3,411
136


<< Personally I disagree about the language neutrality issue. First off, for any project involving a development team, you don't want cowboys coding in the flavor of the month. Thankfully, a good team lead (or organization) would have coding standards to prevent this type of mistake.

True, but it also means I can write a class in C++.NET and you can use it in your VB.NET program with no problems at all, it's not all about groups of people in the same place working on the same project.
>>



This is correct for standard libraries (i.e. C library or Java platform libraries), but it's not too important for application development.

Face it, component-based programming is a pipe dream so far (I'm not saying it's a bad thing). From what I understand, much of the CLR standard library is written in C#, and you can use it in any .Net language.

However, to suggest that one organization implements a module/library in one CLS language, to be consumed by another organization using another CLS language is largely a philosophical matter.

In short, core libraries should have multi-language bindings. Higher-level code doesn't really need it. In my opinion, the language neutrality issue is no big deal.
 

manly

Lifer
Jan 25, 2000
12,624
3,411
136
FWIW, I've done a little reading on the Pet Store marketing campaign, and it's baloney.

First off, Java Pet Store is a sample application to showcase J2EE technologies, particularly design patterns.

For the small size of the app, J2EE is not a good choice because J2EE is overkill. However, that the intent of Java Pet Store isn't a real-world implementation, but a showcase of J2EE development practices.

Secondly, .Net Pet Store isn't even a direct port of Pet Store. It's a complete re-write that has been performance-tuned.

Most significantly, it uses SQL Server stored procedures in the persistence layer. On the other hand, Java Pet Store uses EJB entity persistence, which is database-neutral.

In other words, this isn't a standard benchmark, nor was it a fair comparison on many levels. Marketing campaigns with benchmark claims are usually like that.

Is J2EE slower than .Net? Quite possibly. But if Oracle, BEA or Sun wanted to craft a Pet Store 28 times faster than .Net, that too is also possible. Or a standard C++ Pet Store 28 times faster. You get the picture.