仓酷云

标题: JAVA教程之JAVA程序员眼里的C# [打印本页]

作者: 山那边是海    时间: 2015-1-18 11:41
标题: JAVA教程之JAVA程序员眼里的C#
在1995年5月23日以“Java”的名称正式发布了。程序|程序员JavadevelopersviewofC#.
September03,2004
Therearetwowaystocompareprogramminglanguages:areligiouswaranda"wejustdontcare"typeofattitude.Iwilltrytofindthemiddlegroundandstartwithgeneralities.ThekeyfeatureofbothJavaandC#isautomatedmemorymanagement.Ofcoursethismakesbothlanguagesuselessforwritinganoperatingsystemkernel,butitmakesapplicationdevelopmentsignificantlyeasierbecause

Chancesofamemoryleakareminimized
Wedonthavetowritecodetofreeupmemory
Wecanwritef(g(x))andnotworryaboutfreeingupmemoryusedbythereturnvalueofg(x).
So,wehavetwopopularsoftwaredevelopmentplatforms.Eachofthetwoisusedbymillionsofsoftwaredevelopersandisbackedbyaworldfamoussoftwaregiant,butneitheronecarriesanyrevolutionaryadvantages.



InfluenceofMicrosoft
HistoricallyJavacameaboutearlierthan.NETandslowlycapturednotonlytheserver-sidesoftwaremarket,butalsothemarketofcorporateclientorientedGUIapplications.ThereasonswerethatC++istoocomplexformakingforms,VisualBasicdoesntfeellikeacooldeveloperslanguage,andBorlandinvestedmoreintoJavathanintoDelphi.

However,themoreJavaapplicationsthereare,thesmallerthedemandforWindows.SoMicrosoftdecidednottosupportJava,andtocreate.NETinordertostimulatethedevelopmentofsoftwaredesignedtorunonWindows.Ofcourse.NEThassomecross-platformcompatibility,butfromthepointofviewofWindows,.NETistryingtobecomeapartoftheoperatingsystemlikeInternetExplorer.Thecareerofa.NETdevelopersupposesaclosepartnershipwithMicrosoftincludingtheuseoftheVisualStudioDevelopmentEnvironment,MSSQLdatabase,andtheversioningcontrolsystemVisualSourceSafe.

MicrosoftmarketingdeservesalotofcreditforthefactthatmanysoftwaredevelopmentcompaniestendtothinkaboutsoftwareentirelywithintheMicrosoftframework.Becauseofthat,sometimeswehavetoputasidebelovedJava,andmakeuseofC#.Thegoodnewsis,theexperiencegainedwhileworkingwithJavaishelpfulwith.NET,anddevelopmentof.NETismotivatingprogressofJava.



CVSvs.VSS
ThemajorityofJavadevelopershavegottenusedtoCVS,afterwhichamovetoVisualSourceSafecombinedwithitsintegrationintoVisualStudioandthesolutions-projectsconceptisperceivedasquitepainful.TobefairwemustnotethattheuseofCVSinalargeprojectistheoreticallypossible,buttriggersanegativereactionofpeople,usedtoworkingwithVSS.

HereIcouldthrowsomepunchesonthesubjectof"whyisCVSbetterthanVSS",butIwillnotdothatbecauseCVSisntperfecteither.Thenthereisaprojectcalled"Subversion"whichisopenlypositionedasthereplacementforCVS.NeitherdoesMicrosoftconsiderVSSasitsflagshipproduct,andisworkingonareplacementforitintheformoftheVisualStudio2005TeamSystem.



TheinfluenceofVB.NET
ManylanguagescanbecompiledintobytecodeforJVM,butpracticallyallthesoftwarefortheJavaplatformiswritteninJavaitself.Aprojectfor.NETcanequallylikelybewrittenineitherC#orVB.NET,andquiteoftenbothlanguagesareused.

ClearlyC#andVB.NEThaveveryfewdifferences,exceptforthesyntax,butcreateadivideinthecommunityofdevelopers.EvenifyouwriteexclusivelyinC#,intheresultsofasupportdocumentationsearchyouwillalwaysfindmaterialrelatedtoVB.NET.InadesktopversionofMSDNonecanfilterthecontentbyprogramminglanguage,yetIstillfindtheJavadocumentationmuchmoreconvenientandhelpful.



GUIdevelopment
GUIdevelopmentinC#isatypicalexampleofRAD,likeDelphi.InJavatheGUIisusuallydonewithSwing.EventhoughSwingisquitelargeandcomplex,thefactthatthearchitectureiswellthoughtoutandscalablecombinedwiththeavailabilityofthesourcecodeallowsfordevelopmentofGUIofanycomplexity.



Webapplicationdevelopment
IhavealotofexperienceinwebapplicationdevelopmentinJava,andneverhaveIworkedwithASP.NET.HoweverIreadilyacceptASP.NEThavingsomeminoradvantageswhenitcomestocreatingsmallscalewebsites.Howevertheseadvantagesseparateweb-applicationsintoadistinctsegmentofsoftware.ManydevelopersspecializeineitherwebdevelopmentorGUIdevelopment.InJavaweb-applicationscaneasilybecreatedwithouttheuseofspecialtechnologieslikeJSP,JSTLorStruts.AllyouhavetosayisextendsHttpServlet.

OfcourseJavawillnoteasilygiveupthemarketofwebdevelopment.WecanexpectmorenewsfromJavaServerFacesandFabrique.Inanycasewebpagedevelopmentisnotamongthemostcomplicatedproblemsforamodernprogramminglanguage.



Iseverythingobject?
InJavathereisapopularslogan"Everythingisobject",inC#thiswouldnotbetrue.ThefirstthingthatstandsoutistheexistenceofstructuresinC#.Obviouslywearemotivatedtousestructurestoincreaseproductivity,butIthinkmoderncomputersareproductiveenoughnottorequiretheadditionofanotherentityinaprogramminglanguage.

AlsoanonymousclassesarereplacedbydelegatesinC#.Thisistheideathatifamethodhasadefinitesetofargumentsandagivenreturntype,itisabsolutelyunimportantwhatitsnameisandwhetherornotitisstatic,oranyothernonsense.Youcanjustcallit.

Whileweareonthesubjectofdelegates,weshouldalsomentionevents.TheyreallydodecreasethecodevolumeinGUIdevelopment.HoweverthiscomesatapriceofgoingagainstOOPprinciples.

InadditionC#hassomeaddedabilities,whicharenotpresentinJava.Withoutgoingintomuchdetail,Iwillmentionoperatoroverloading,andkeywordssuchasvirtual,override,ref,outandparam.



Theinfluenceofthedevelopmentplatformontheprogrammersself-consciousness
Withoutadoubt,theonethingthatinfluencesthequalityofsoftwareisthequalityofsoftwaredevelopers,andnottheprogramminglanguage.Nevertheless,myexperiencetellsmethatinthemajorityofJavaprojectsAntisusedforbuildmanagement.Ontheotherhandin.NET,buildsareoftendonewithtoolsbuiltintoVisualStudio,eventhoughanalogousinstrumentsexistfor.NET.Besides,C#doesnothaveclearrulesfornamingclassesandstoringthemondisk.Thisoftencreatesadditionalconfusion(whichqualifiedprogrammerssuccessfullyovercome).

C#doesnthavecheckedexceptions,thereasonsforwhichareexplainedhere.Thisdecisionhasitsreasons,butifthecompilerdoesntcontrolhandlingcheckedexception,thereneedstobemoreinformationonhowtoworkwitherrorsthroughothercommunicationchannels.Otherwisesomeprogrammerswillnotevenknowwhatexceptionsare.



Thetigersarechargingforward
TherearecertainareaswhereJavaisclearlydominating,forexamplecellularphonegamesandtheJavaCardtechnology.However,thestruggleformarketsharebetweenC#andJavawillgoonforalongtimetocome.Bothplatformswillbeimproved.ForexamplebothJava5and.NET2.0willsupportgenerics.

Itisobviousthatthesuccessofeveryindividualprojectwilldependnotontheprogramminglanguageused,butontheunderstandingofthetask,knowinghowtogiveunderstandablenamestomethods,abilitytoavoidrepetitiouscode,andotheruniversalvirtues.



Acknowledgements
IreallyappreciatethehelpofDmitryJemerov,thankstowhomyoudidnthavetoreadanyofthenonsensewhichIwroteatfirst.IalsothankDataArtcompany,whichgavemeachancetostudyC#onthejob,mycolleaguesatDataArt,whogavemeintellectualhelpandboostedmymoral,andtheJetBrainscompanyforgoodtimingindevelopingtheReSarpertool,whichallowsmetohavealmostasmuchfunwithC#asIamusedtohavingwithIntelliJIDEA.AspecialthankstoAlexeyPchelintsevforeditingtheRussianversionandtoPavelSokolovforthetranslation.



References

TheC#ProgrammingLanguageforJavaDevelopers
http://msdn.microsoft.com/vstudio/java/gettingstarted/csharpforjava/

J2EEfundamentalsfor.NETdevelopers
http://www-106.ibm.com/developerworks/java/library/j-roadmap1/
YakovSirotkin
SeniorDeveloper,DataArt

大型的应用一般不会用这些框架(因为性能考虑);开发人员根据需要选择用一些框架,也可以不选用框架;不用框架并不代表要自己写框架;修改框架的可能性更小。
作者: 简单生活    时间: 2015-1-21 12:58
还好,SUN提供了Javabean可以把你的JSP中的 Java代码封装起来,便于调用也便于重用。
作者: 爱飞    时间: 2015-1-30 18:44
应用在电视机、电话、闹钟、烤面包机等家用电器的控制和通信。由于这些智能化家电的市场需求没有预期的高,Sun公司放弃了该项计划。随着1990年代互联网的发展
作者: 第二个灵魂    时间: 2015-2-6 08:18
如果要向java web方向发展也要吧看看《Java web从入门到精通》学完再到《Struts2.0入门到精通》这样你差不多就把代码给学完了。有兴趣可以看一些设计模块和框架的包等等。
作者: 谁可相欹    时间: 2015-2-6 12:47
当然你也可以参加一些开源项目,一方面可以提高自己,另一方面也是为中国软件事业做贡献嘛!开发者在互联网上用CVS合作开发,用QQ,MSN,E-mail讨论联系,天南海北的程序员分散在各地却同时开发同一个软件,是不是很有意思呢?
作者: 若天明    时间: 2015-2-13 22:13
其实说这种话的人就如当年小日本号称“三个月拿下中国”一样大言不惭。不是Tomjava泼你冷水,你现在只是学到了Java的骨架,却还没有学到Java的精髓。接下来你得研究设计模式了。
作者: 深爱那片海    时间: 2015-2-16 08:48
如果要向java web方向发展也要吧看看《Java web从入门到精通》学完再到《Struts2.0入门到精通》这样你差不多就把代码给学完了。有兴趣可以看一些设计模块和框架的包等等。
作者: 兰色精灵    时间: 2015-3-5 02:20
当然你也可以参加一些开源项目,一方面可以提高自己,另一方面也是为中国软件事业做贡献嘛!开发者在互联网上用CVS合作开发,用QQ,MSN,E-mail讨论联系,天南海北的程序员分散在各地却同时开发同一个软件,是不是很有意思呢?
作者: 透明    时间: 2015-3-5 16:27
还好,SUN提供了Javabean可以把你的JSP中的 Java代码封装起来,便于调用也便于重用。
作者: 变相怪杰    时间: 2015-3-7 05:48
Java自面世后就非常流行,发展迅速,对C++语言形成了有力冲击。Java 技术具有卓越的通用性、高效性、平台移植性和安全性,广泛应用于个人PC、数据中心、游戏控制台
作者: 只想知道    时间: 2015-3-12 23:47
如果你学过HTML,那么事情要好办的多,如果没有,那你快去补一补HTML基础吧。其实JSP中的Java语法也不多,它更象一个脚本语言,有点象ASP。
作者: 活着的死人    时间: 2015-3-13 00:08
那么我书也看了,程序也做了,别人问我的问题我都能解决了,是不是就成为高手了呢?当然没那么简单,这只是万里长征走完了第一步。不信?那你出去接一个项目,你知道怎么下手吗,你知道怎么设计吗,你知道怎么组织人员进行开发吗?你现在脑子里除了一些散乱的代码之外,可能再没有别的东西了吧!
作者: 灵魂腐蚀    时间: 2015-3-13 23:07
是一种突破用户端机器环境和CPU
作者: 蒙在股里    时间: 2015-3-19 23:01
《JAVA语言程序设计》或《JAVA从入门到精通》这两本书开始学,等你编程有感觉的时候也可以回看一下。《JAVA读书笔记》这本书,因为讲的代码很多,也很容易看懂,涉及到面也到位。是你学习技术巩固的好书,学完后就看看《JAVA编程思想》这本书,找找一个自己写的代码跟书上的代码有什么不一样。
作者: 飘灵儿    时间: 2015-4-1 18:10
Java 编程语言的风格十分接近C、C++语言。
作者: 山那边是海    时间: 2015-4-5 01:41
关于设计模式的资料,还是向大家推荐banq的网站 [url]http://www.jdon.com/[/url],他把GOF的23种模式以通俗易懂的方式诠释出来,纯Java描述,真是经典中的经典。
作者: 再见西城    时间: 2015-4-8 04:37
你现在最缺的是实际的工作经验,而不是书本上那些凭空想出来的程序。
作者: 莫相离    时间: 2015-4-10 07:34
应用在电视机、电话、闹钟、烤面包机等家用电器的控制和通信。由于这些智能化家电的市场需求没有预期的高,Sun公司放弃了该项计划。随着1990年代互联网的发展
作者: 仓酷云    时间: 2015-4-11 01:13
一直感觉JAVA很大,很杂,找不到学习方向,前两天在网上找到了这篇文章,感觉不错,给没有方向的我指了一个方向,先不管对不对,做下来再说。
作者: 冷月葬花魂    时间: 2015-4-14 16:46
有时间再研究一下MVC结构(把Model-View-Control分离开的设计思想)




欢迎光临 仓酷云 (http://ckuyun.com/) Powered by Discuz! X3.2