Solved

Web Best Practice - HTML rendering from c#, vb.net into ASPx or php?

Posted on 2011-03-06
7
753 Views
Last Modified: 2013-11-11
Hi Experts,

I am interested in some resources and ideas on what is the best method in web 2.0 and 3.0 coming up for building tight well organised, css based sites of the future.
Facebook is written in PHP with a MySql backed.

Traditionally I am a Microsoft programmer knowing c#, vb.net and asp/ asp.net.
However the controls and asp ajax tend to be clunky, heavy on HTML encoding and slow in general.  I have been using DotNetNuke as a CMS, but I am loving Wordpress at the moment.

Should I learn PHP and MySQL and go the Open Source way, or should I learn how to program using C#, without using ASP (just rendering HTML)

What methods are used for PHP rendering - from what I can tell in the Wordpress world it is pretty much writing the HTML as needed like in classic asp days.

What is the best practices for HTML rendering these days?
What is the best most efficient language to use to build a database driven content managed system?

Is LINQ better than SP and MySQL? Faster?
0
Comment
Question by:Craig Lambie
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 250 total points
ID: 35046594
There are numerous methods of rendering html. Microsoft is investing heavily in MVC and new rendering engines such as Razor. MVC3 especially allows you to plug in other rendering engines as well if you prefer an alternative to microsofts offering. The idea of MVC and the newer view engines is to reduce bloat in html pages and streamline the process. Not done huge amounts with PHP myself, but there are MVC frameworks available.

The LINQ vs SP+MySQL isn't really a valid comparison. LINQ is purely a querying construct that runs over the top of any supported datasource type, it doesn't actually talk to the database directly. In the .Net world you are more likely to use an ORM framework such as Linq-to-SQL or Entitity Framework which you can then query using LINQ. But you still have the option to use stored procedures under the hood for all of your database communication.
0
 
LVL 3

Assisted Solution

by:wwwdeveloper2
wwwdeveloper2 earned 250 total points
ID: 35046726
Personally, I think the best thing you could do is become as informed as possible about xhtml and css.  Knowing xhtml and css standards will automatically assist you with writing web applications that are more efficient.  After all, no matter what application language  you choose to write your web applications, the end result will be xhtml and css (and sometimes javascript) delivered to the client's browser for it to render.

Knowing not to embed old deprecated html font tags, font sizes, alignment tags, etc. a hundred times on your rendered page will be key for efficiency for your application that is rendered in the browser.  It is better to just create the styles in css and cascade them down to your page via a div or class.

Whenever I can pass some of the processing to the client browser and not on the server for basic things like outputting html, I do.  For example:

Using php you can have the php create an xhtml table on the server side to send to the browser:

<?php

echo "<table width=\"400\" border=\"1\">
  <tr>
    <td>".$somephpvariable . " </td>
   
  </tr>
  <tr>
    <td>" . $anotherphpvarible . "</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>";

?>

OR if your logic allows, I prefer to take the work off of php server and just put php inside the xhtml for the variables I want to show the client's browser:

<table width="400" border="1">
  <tr>
    <td><?php echo $somephpvariable; ?> </td>
   
  </tr>
  <tr>
    <td><?php echo $anotherphpvariable; ?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>


Anyway, I could ramble on and on for several days about the different techniques.  As you probably already know, a programming task can be completed a hundred different ways.   I have always just felt that a programmer that is building web applications, should be an expert on xhtml and css techniques and standards, since that after all is what their program will be delivering as an end result.

I have seen some pretty nasty xhtml generated from lazy and clueless programmers who output junk html and css...then they complain that their application is slow and doesn't work correctly on some browsers.  It all pretty much boiled down to the programmer being clueless about xhtml and css.

Personally I have tried programming in ASP.NET, I felt very constrained in the flexibility it offered to me as a developer.  Like a lot of Microsoft products, ASP.NET just seemed to try and be too smart.   It wrote a lot of what I considered unnecessary client code (html & css) and it trying to modify it was a nightmare.  I also find it difficult to find a lot of support and resources for certain situations.  At the time I was trying to use it with Oracle tables, and it seemed most of the ASP.NET bells and whistles would only easily work with SQL Server - - which makes sense for Microsoft...but not very flexible for developers who don't have the luxury of working in a pure Microsoft environment.

I prefer php, because there are tons of support and resources that can quickly aid a developer who has hit a roadblock.  Php is super easy to learn and is easy to program in.  It amazes me of the amount of support and examples published on the Internet.   At work we mainly use PHP and Oracle.  Some of our Oracle tables have hundreds of thousands of rows and hundreds of tables,  Php seems to do just find with parsing out the data and delivering it to the client's browser.

Away from work I use mysql and php for my projects.  I'm working on a project right now that uses php to go out collect data from external feeds and writes it to my db tables.  Right now it has around 28,000 rows in it.  My php application is still rock solid and parses the information almost instantly.

Good luck with whatever you decide to do.

If you have any questions, just let me know.
0
 
LVL 1

Author Comment

by:Craig Lambie
ID: 35048285
carl_tawn:
Thanks for the reply.
I haven't looked at MVC at all yet - bit behind on the MS coding front I guess as worked in Corporate mostly - so generally a few years behind the 8 ball... haha
I will investigate - any articles you recommend reading to start?
Does MVC3 output a stack of rubbish HTML to the client as @wwwdeveloper2 suggests these programs do.

I have felt a little limited by ASP.net as at the end of the day HTML is output, and Javascript is still by far the best client side scripting language - especially with the libraries that are available now.

As for comparing LINQ with the others - it was more the fact that you are writing the queries directly in the code, so how does the speed of querying compare to PHP methods I guess at the end of the day... I have found that LINQ is definitely faster than SP/MSSQL combinations - I haven't used LINQ to connect to anything but SQL Server mind.

wwwdeveloper2:
I have found PHP to be fairly easy to learn yes - as a programmer it is pretty simple to pick up another language and start to work with it, and there are stacks of examples out there too, which makes life lots easier.  As to methodology - the first method you mentioned is the one I used in classic ASP and PHP - I just wonder if that is considered the best method considering the massive amounts of options out there.... And I often wonder about the article I read once that if Facebook was written in c# it would be 40% more efficient.

I wonder what the likes of the below best of web2.0 sites are written in.
http://basecamphq.com/
http://www.stumbleupon.com/
http://www.ning.com/
http://www.netvibes.com/en

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Accepted Solution

by:
wwwdeveloper2 earned 250 total points
ID: 35048341
StumbleUpon and Ning both use PHP

http://www.stumbleupon.com/signup.php?pre=homepage
http://www.ning.com/index.php

37Signals are famous for being pro-Ruby, so I would assume that is what they are using.  Not sure about netvibes.

As far as the comment about facebook being written in c# that it would be more efficient.  I have no idea what they were talking about.  Did Microsoft write the article or were they sponsors?

The thing is, you can worry about html rendering engines and such, but if you just follow STANDARD coding standards (W3C) to have your coded applications output Standard HTML, you should be pretty safe that your end result will be efficient and will working in ALL browsers no matter what html rendering engine they are utilizing.

I've always felt that if you are using something to output your html code for you instead of doing it yourself, it it a lot like having some other guy take your wife out for your anniversary - You couldn't handle the job yourself and you don't know what kind of crap she will come back with! :)

0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 250 total points
ID: 35054170
Asp.Net does dump some fairly heafty HTML, but that's part of the nature of how it handles its state information. The MVC framework is a lot more terse with its output, which was one of the aims for MVC from the start. A basic intro to MVC can be found here:

     http://www.asp.net/mvc

I'm suprised you found LINQ to be quicker, given that it is another layer of abstraction over the standard connection objects (although I guess it depends on what data access techniques you normally use).

Also, working with Oracle, Access, etc is no more difficult in .Net that working with SQL Server; maybe wwwdeveloper2 is referring to specific issues he had rather than the technology as a whole.

Hmm, sounds like i'm advocating Microsoft a lot here, which i'm not. A lot of people pan Microsoft just because it's Microsoft, i'm just trying to provide a bit more of a balanced view. There are numerous technologies and platforms to do what you are talking about each with their own pros and cons.
0
 
LVL 28

Expert Comment

by:sybe
ID: 35056094
> Asp.Net does dump some fairly heafty HTML, but that's part of the nature of how it handles its state information.

Actually it is "webforms" that does that, and it is easy to avoid webforms with asp.net. Just don't use the <form runat=server> thing. That of course cancels also many other things that come with webforms, but it keeps the HTML code clean and keeps the sever-side part understandable.
0
 
LVL 1

Author Closing Comment

by:Craig Lambie
ID: 35195410
Thanks for all the info!

I think I am going to use c# and MSSQL or MySQL as the backend and only XHTML/Ajax/Javascript as the front end, no aspx controls at all.

I have used DotNetNuke as a CMS in the past, but I think it is to cumbersome for something as simple as this, so I will be looking for another one so I don't have to reinvent the wheel.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now