問題描述
作為一個(gè)使用 Adob??e 的 ColdFusion 編寫 Web 應(yīng)用程序大約 10 年的人,我決定將 ASP.NET 作為字符串添加到我的弓上.
As someone who has spent around 10 years programming web applications with Adobe's ColdFusion, I have decided to add ASP.NET as a string to my bow.
對于長期使用 CF 和底層 Java 的人來說,ASP.NET 對我來說似乎有點(diǎn)陌生.我應(yīng)該如何開始使用 ASP.NET,這樣我才能真正危險(xiǎn)地使用它?我需要非常詳細(xì)地了解 C# 嗎?
For someone who has spent so long with CF and the underlying Java, ASP.NET seems a little alien to me. How should I go about getting up to speed with ASP.NET so that I can be truly dangerous with it? Do I need to know C# at any great amount of detail?
我希望能夠快速構(gòu)建基本的網(wǎng)絡(luò)應(yīng)用程序,這樣我就可以學(xué)習(xí)更多做棘手的事情.
I want to be in a position where I can build basic web apps fairly quickly so I can learn more doing the tricky stuff.
推薦答案
我可能只有六個(gè)月的時(shí)間走同樣的路,但以下是我迄今為止的經(jīng)驗(yàn)中的一些想法:
I'm only maybe six months down the same path, but here are some thoughts from my experience so far:
如果您完全有 Java(甚至 CFScript)方面的經(jīng)驗(yàn),那么 C# 語言應(yīng)該不會(huì)給您帶來太多問題.不過,作為參考,當(dāng)我開始時(shí),我發(fā)現(xiàn) csharp-station 是一個(gè)很好的語言入門基本.就 ASP.NET 而言,它對您沒有多大幫助;但它對語法有好處.更多您將熟悉 .NET 庫.IDE 實(shí)際上可以在這里提供巨大的幫助.
The C# language shouldn't give you much problem if you have very much experience with Java at all (or even CFScript). As a reference, though, when I was starting, I found csharp-station a good primer for language basics. It won't help you much as far as the ASP.NET side goes; but it is good for syntax. More you'll be familiarizing yourself with the .NET libraries. The IDE actually can be an enormous help here.
以下是我在進(jìn)行過渡時(shí)發(fā)現(xiàn)的三個(gè)最大差異:
Here are the three biggest differences I found making the transition:
- ASP.NET 服務(wù)器控件 - 在 ColdFusion 中,您確實(shí)擁有漂亮的直接控制 HTML;你與頁面密切合作.情況并非如此ASP.NET.服務(wù)器控件是旨在減輕你的很多乏味,但可能要付出一些代價(jià)直接控制.作為一名CF程序員,我對得到的東西很挑剔實(shí)際輸出到瀏覽器;和起初 ASP.NET 讓我很沮喪因?yàn)樗鼤?huì)吐出很多額外的東西代碼.盡管如此,控件仍然是真的很強(qiáng)大,而且值得熟悉他們.表單和驗(yàn)證控件,尤其是,讓你免于很多CF中處理帖子的乏味返回和驗(yàn)證.W3學(xué)校實(shí)際上有一個(gè)不錯(cuò)的 網(wǎng)絡(luò)列表服務(wù)器控件.
- 頁面模型 - ColdFusion 在頁面方面是相當(dāng)不可知的流動(dòng).ASP.NET 非常適合傾向于使用后背,并且是非常事件驅(qū)動(dòng).如果你不是使用帶有 CF 的框架(例如模型膠),這可能是陌生的你..NET 負(fù)責(zé)處理很多回發(fā)行為你.還有,不是說ColdFusion 不能成為對象并且良好使用驅(qū)動(dòng)的功能CFC 的,但 ASP.NET 確實(shí)試圖將您推向 OO 路徑比較以我的經(jīng)驗(yàn)為 CF.
- 數(shù)據(jù)庫訪問 - 使用 ASP.NET 真的讓我很感激強(qiáng)大的cfquery 真的是.這csharp-station網(wǎng)站也有不錯(cuò)的使用本機(jī)的教程.NET 數(shù)據(jù)庫工具.我沒有工作足夠的項(xiàng)目尚未開始尋找用于數(shù)據(jù)庫訪問擴(kuò)展;我是很確定杰夫推薦他們用來做的東西建立這個(gè)網(wǎng)站,所以你可以檢查出.不然我真的建議你熟悉一下與 DataSet 對象.它是有點(diǎn)類似于查詢對象在 CF 中,并讓您運(yùn)行查詢查詢等...循環(huán)CF 中的查詢很常見,但它幾乎沒有發(fā)生ASP.NET 因?yàn)閿?shù)據(jù)綁定.
- ASP.NET Server Controls - In ColdFusion, you really have pretty direct control over the HTML; you work very closely with the page. This isn't so much the case in ASP.NET. The server controls are meant to relieve you of a lot of the tedium, but at a cost of maybe some direct control. As a CF programmer, I'm very particular about what gets actually output to the browser; and at first ASP.NET frustrated me because it spits out a lot of extra code. Still, the controls are really powerful, and it pays to familiarize yourself with them. Form and validation controls, especially, save you from a lot of the tedium in CF of handling post back and validation. W3Schools actually has a decent list of web server controls.
- The page model - ColdFusion is pretty agnostic in terms of page flow. ASP.NET is very much geared towards using post backs, and is very event driven. If you're not using a framework with CF (e.g. Model Glue), this may be foreign to you. .NET takes care of handling a lot of the post back behavior for you. Also, not to say that ColdFusion can't be object and function driven by good use of CFC's, but ASP.NET really tries to push you down the OO path compared to CF in my experience.
- Database access - Using ASP.NET really made me appreciate how powerful cfquery really is. The csharp-station site also has a good tutorial on working with the native .NET db tools. I haven't worked on enough projects yet to start looking around for DB access extensions; I'm pretty sure Jeff recommended something that they used for building this site, so you might check that out. Otherwise, I really suggest you familiarize yourself with the DataSet object. It's somewhat similar to a query object in CF, and lets you run query of queries, etc... Looping over queries in CF is very common, but it doesn't happen nearly as much in ASP.NET because of data binding.
這篇關(guān)于作為 ColdFusion 開發(fā)人員,您應(yīng)該如何學(xué)習(xí) ASP.NET?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!