Is ASP.NET really as good as they claim? (No, this isn't a troll, please read)

J

Jim Corey

Alan,

I had a similar experience with those databound controls back in VB6 and
would never use them in .NET.

I'm sure that most developers here code their own data access tier.

In ASP you probably have a library of include files that handle your
data access. In ASP.NET you'll want to create a set of classes that
will do this. My recommendation would be to check out CodeSmith or
LLBLGen Pro and see the kind of code that people generate with these.

The data and business logic tiers are where you'll find the real value
in ASP.NET, and I think these will be the most stable parts of this
system.

IMO the front-end is very idiosyncratic, and it's very difficult to
figure out a good architecture -- there's so many options and examples
that you can go down many dead ends before finding a good one.
 
J

Juan T. Llibre

Good points, Jim.

I'd add that *no* autogenerated data access code
can be as effective as optimized hand-coding.

As an example, just see the difference in speed between an
autogenerated query and the execution of a stored procedure.

Parameterized queries, which I don't think any of the code generation
tools can do, if I'm not mistaken, is another example.

The use of the Cache object is another.

In sum, relying on automatic code generators is OK
when you're learning how to code, but that code
tends not to scale very well.




Juan T. Llibre
ASP.NET MVP
===========
 
K

Kevin Spencer

Hi Alan,
I was mainly asking about the visual tools that seem to make the coding
that was needed in ASP redundant. For example, in ASP Web Matrix (which is
what I was using before I posted here), there is a feature where you can
connect to a database, drag bits onto your form and make it into a grid
and in about 3 picoseconds (maybe slightly more) you have a paging grid of
data from your database. The attraction of this is immense, but I was (and
still am) slightly worried if it was really as good as it seems when you
try using it for serious work.

Good question. I use the drag-n-drop capabilities of the IDE from time to
time, but not for most of what I do. For example, I developed my own data
classes, as the projects I work on use databases quite a lot. For a small
app with a single or just a couple of database connections, I would expect
that the tools in the IDE would be sufficient. However, for a larger app,
the tools add a lot of unnecessary overhead. However, for adding WebControls
and other Controls to a page, the drag-n-drop tools can be quite effective.
I just wouldn't depend on them too much.

Actually, there are quite a few programmatic considerations that make
ASP.Net faster to develop. The object-oriented nature of the .Net platform
includes things like inheritance and polymorphism, which can make
code-writing much more efficient. Again, for example, take my data classes.
Once written, I have used them in several dozen applications. I only had to
write them once.

Good object-oriented design can considerably reduce the amount of code you
work with. By making good use of inheritance, you can create base classes
that contain functionality common to many uses, and inherit these classes to
create extensions that handle specific issues with very little additional
code.

It takes a bit of time to develop your own reusable classes, but once done,
they're done, and you can reuse them all over the place. Fortunately, the
CLR has thousands of ready-made classes that can be used or extended by your
own inherited classes. The key is good architecture and design. A little
extra time spent up-front designing can save hundreds of hours of coding in
the long run.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
A

Alan Silver

I had a similar experience with those databound controls back in VB6 and
would never use them in .NET.

Ah ha, so my suspicions were not unfounded.

Please can you be more specific. Remember I'm new at ASP.NET, so I'm not
sure of my way round yet. What pointers would you give for what to avoid
and what to use?
I'm sure that most developers here code their own data access tier.

In ASP you probably have a library of include files that handle your
data access. In ASP.NET you'll want to create a set of classes that
will do this.

Sounds sensible. I'm very new here, so this isn't going to be immediate.
Please could you post some simple example code to get me started?
My recommendation would be to check out CodeSmith or
LLBLGen Pro and see the kind of code that people generate with these.

What are these?
The data and business logic tiers are where you'll find the real value
in ASP.NET, and I think these will be the most stable parts of this
system.

IMO the front-end is very idiosyncratic, and it's very difficult to
figure out a good architecture -- there's so many options and examples
that you can go down many dead ends before finding a good one.

That's why I'm asking all these questions ;-)

Thanks for the reply
 
A

Alan Silver

Kevin and Juan,

Thanks for your replies. You are both confirming what I suspected, all I
need now is some pointers in the right direction. Remember I'm new at
this and have almost no idea of how to go about it. Any chance you could
provide some simple examples of good practice code? This would really
help me get going.

All the tutorials seem to rely on the simplicity of the IDE's data
tools. I haven't yet found any tutorials that explain best practices
like you are suggesting.

Any further help would be greatly appreciated. Thanks again.
 
J

James Thomas

In terms of data classes, look into the ADO .NET classes available to
you, such as DataSet, SqlDataAdapter, SqlDataCommand, etc. - I wrote
front ends to most of these to simplify my DB coding - it's now very
simple from a coding standpoint but powerful in functionality.

I taught myself most of the ASP .NET/C# that I know (with some help
from these boards where needed!) and I tell you that I absolutely love
it. I come from a C, C++ background (I used to LOVE C++, now I LOVE C#)
and writing .cgi (using C) to accomplish this functionality. Now I use
C# and ASP .NET and will *never* go back.

The DataGrid alone is very simple yet extremely flexible and powerful.
And ASP .NET 2.0 is bringing out the GridView, which I absolutely
cannot wait for!

James
 
J

Jim Corey

and what to use?

If you use Visual Studio, you have the opportunity to drag and drop
controls like 'SqlConnection'. These are the kind of things I (and I
suspect most) avoid. I think they exist mainly so that MS reps can do
quick, flashy demos.

CodeSmith, at http://www.ericjsmith.net/codesmith/default.aspx
is a fascinating tool, although to be honest it took me a couple of
looks to figure out what was going on. You can point at a set of tables
and get class and data access code generated, and these would be
separate from the code for your pages. Check the forums for templates
you can download.
 
A

Alan Silver

In terms of data classes, look into the ADO .NET classes available to
you, such as DataSet, SqlDataAdapter, SqlDataCommand, etc. - I wrote
front ends to most of these to simplify my DB coding - it's now very
simple from a coding standpoint but powerful in functionality.

OK, thanks. That's a good place to start. As long as I have some idea
what to look for and what to avoid, I can make some progress (I hope!!)

I guess I can go through the demos and tutorials, and look for the ones
with these sort of controls.

Thanks
 
A

Alan Silver

Hi alan,
The best I can give you is a URL to download the FREE Microsoft .Net SDK,
which contains tutorials, articles, sample code, and a complete reference:

Kevin,

Thanks for the URL. I already have that, I got a CD. I went through the
Web Matrix stuff in there, which was fine as far as it went, but a) it
only really dealt with simple stuff and b) it used all the sorts of
quick tools that got me suspicious enough to start this thread in the
first place!!

Once you go into the main SDK stuff, too many of the tutorials are based
around VS.NET which I don't have. I couldn't follow them. Having said
that, I've now got the Visual Web Developer Express tool, which I think
is very closely related to VS.NET, so maybe I can try those again.

Thanks again
 
J

Juan T. Llibre

And the best place to get updated info
which includes ASP.NET 2.0, is :

http://beta.asp.net/

Tons of good info there...



Juan T. Llibre
ASP.NET MVP
===========
Kevin Spencer said:
Hi alan,

The best I can give you is a URL to download the FREE Microsoft .Net SDK,
which contains tutorials, articles, sample code, and a complete reference:

http://www.microsoft.com/downloads/...A6-3647-4070-9F41-A333C6B9181D&displaylang=en

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.
 
A

Alan Silver

What pointers would you give for what to avoid
and what to use?

If you use Visual Studio, you have the opportunity to drag and drop
controls like 'SqlConnection'. These are the kind of things I (and I
suspect most) avoid. I think they exist mainly so that MS reps can do
quick, flashy demos.

Thanks. Any others to avoid? ;-)
CodeSmith, at http://www.ericjsmith.net/codesmith/default.aspx
is a fascinating tool, although to be honest it took me a couple of
looks to figure out what was going on. You can point at a set of tables
and get class and data access code generated, and these would be
separate from the code for your pages. Check the forums for templates
you can download.

Thanks, I'll take a look at that.
 
A

Alan Silver

CodeSmith, at http://www.ericjsmith.net/codesmith/default.aspx is a
fascinating tool, although to be honest it took me a couple of looks to
figure out what was going on. You can point at a set of tables and get
class and data access code generated, and these would be separate from
the code for your pages. Check the forums for templates you can download.

OK, I had a look at the site, but I think I missed the point. What would
I need it for? It looks like it generates code. Well don't Web Matrix,
Visual Web Developer and VS.NET do the same sorts of things? It looks
like you have to learn yet another set of syntax to achieve what they
already do.

Presumably I'm wrong, otherwise there wouldn't be any point to it. Since
he spent time developing it and you recommended it, obviously there's
more to it ;-)

Please enlighten me. Thanks
 
S

Scott Allen

In some sense it's just another tool to generate code. The nice thing is
I can write templates to look at any piece of metadata (like a schema, an
xml or xsd file, etc), and have it write code over and over. Code for stored
procs, for middle tier data objects, or for bound columns in a data grid
- anything at all really. Then next week when I add two columns to a database
table I can re-gen all the code again and not worry about tracking down which
files to change . The code is exactly like I want it since I wrote the template.


So, it is just a tool - a codegenerator. For some applications and processes
it is a great fit and far more capable than using the IDE and SDK tools alone.
 
A

Alan Silver

In some sense it's just another tool to generate code. The nice thing
is I can write templates to look at any piece of metadata (like a
schema, an xml or xsd file, etc), and have it write code over and over.
Code for stored procs, for middle tier data objects, or for bound
columns in a data grid - anything at all really. Then next week when I
add two columns to a database table I can re-gen all the code again and
not worry about tracking down which files to change . The code is
exactly like I want it since I wrote the template.

So, it is just a tool - a codegenerator. For some applications and
processes it is a great fit and far more capable than using the IDE and
SDK tools alone.

Thanks Scott, I get the point now. I think it's a bit beyond me at the
moment, but worth bearing in mind for when I (hopefully) have more idea
what I'm doing ;-)
 
G

Guest

Hi Alan!

Two years ago my software company (http://www.factordigital.com) has elected
..NET as its core technology. Before that we used ASP.

The difference I noticed is that with .NET you must be more strict with your
development process. Things that in ASP could be resolved within seconds of
code "hammering" are no longer resolved by the same way in .NET.

In .NET you have to think very well before coding, or else you are wasting
time.
The advantage is that .NET gives you a excelent way of structuring your
code, with classes, objects, collections, and lots of that coding-artillery
that wasn't available in ASP...


Regards, Manuel C
 
A

Alan Silver

Hi Alan!
Two years ago my software company (http://www.factordigital.com) has elected
.NET as its core technology. Before that we used ASP.

The difference I noticed is that with .NET you must be more strict with your
development process. Things that in ASP could be resolved within seconds of
code "hammering" are no longer resolved by the same way in .NET.

In .NET you have to think very well before coding, or else you are wasting
time.
The advantage is that .NET gives you a excelent way of structuring your
code, with classes, objects, collections, and lots of that coding-artillery
that wasn't available in ASP...

Manuel,

Thanks for the comment. What sort of issues need to be considered? I
must admit that a lot (most?) of my ASP followed the "hammering it out
and seeing what's missing" approach. I never have the patience for
planning in advance. What would I have to consider?

Thanks again
 
G

Guest

One of the ways to pick up on how to do things in .NET is to peruse the
patterns and practices site. They have developed code blocks that are
supposed to help you develop your applications properly. Most people I know
don't use the code blocks because they've all developed their objects,
methods, classes, etc.

If you are new to .NET these code blocks are a really good way to see how to
properly develop a class structure for the most common programming
requirements.

Here is a link to the code blocks.

http://www.microsoft.com/resources/practices/code.mspx
 
G

Guest

Hi Alan

In a (hopefully) clear answer to your question is yes, ASP.NET is nto full
of red-herrings and technological dead-ends.
The Page Object that ASP.NET is built on is very good and efficient and
simple to extend, customise.
ASP.NET makes developing professional, enterprise scale, robust applications
considerably easier than ASP ever could, while presenting a reasonably cheap
maintenance cycle.
My experience is a large online database/catalogue for NHS purposes and has
had to meet certain government and operational requirements, such as
switchable scalability, error reporting.
This site was not written using the Forms architecture but was integrated
into the Page object nonetheless. We have achieved absolute tier-separation,
the XML classes and Remoting classes in .NET are fantastice, the death of
prolific DCOM cannot happen soon enough.
XSLT is the presentation tier and OO takes care of the rest...

ASP.NET enabled this in 4 months (5 meg of code) whereas ASP/VB/C++ would do
this in 12... A very significant improvement.

The learning curve was very steep but it paid for itself almost immediatly
as a good, robust design is easy to implement and prove in ASP.NET.
Testing/debugging is lovely...

It is only as good as the developer and designer allow however and there is
plenty of potential for problems, especially it seems with Grid controls and
the like, so there is care required and it doesn't get you out of the need to
make sure the design is sensible.

I hope this helps and doesn't add to the quagmire of opinion in response to
your question.

I would recommend going down the ASP.NET route, you will not be
disappointed, and your old code-library will not be entirely redundant and
some of it can be reused directly... and the rest translated very easily.

It is also very performant...
 

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