Tải bản đầy đủ - 0 (trang)
Chapter 1: Building an ASP.NET Website

Chapter 1: Building an ASP.NET Website

Tải bản đầy đủ - 0trang

Chapter1:BuildinganASP.NETWebsite



Overview

Inthisbookwearegoingtobuildacontent-basedASP.NETwebsite.

Thiswebsitewillconsistofanumberofmodules,whichwillallfittogether

toproducethefinishedproduct.

Wewillbuildeachmoduleinastandardorder:

Identifytheproblem-Whatdowewanttodo?Whatrestrictions

orotherfactorsdoweneedtotakeintoaccount?

Produceadesign-Decidewhatfeaturesweneedtosolvethe

problem.Getabroadideaofhowthesolutionwillwork.

Buildthesolution-Producethecode,andanyothermaterial,

thatwillrealizethedesign.

Thisbookfocusesonprogramming.Whenwetalkaboutdesign,we

generallymeandesigningthesoftware-wewillnotbelookingatgraphic

oruserinterfacedesign.

Yourwebsitewillnotbesolvingallofthesameproblemsasours,but

manyofthemoduleswebuild-andtheprogrammingtechniquesweuse

-areverytransferable.

Inthischapterwewilltakeahigh-levellookatthewholesite-whatit

needstodo,andhowitwilldoit.



Chapter1Buildingan

ASP.NETWebsite

byMarco

BellinasoandKevin

Hoffman?

WroxPress?2002



TheProblem

WewillbebuildingawebsiteforDVDandbookenthusiasts.Inoutlining

thesite'sproblem,weneedtoconsiderthepurposeandaudience.Inreal

lifethisstagewouldbebusiness-oriented-takingintoaccountthingslike

advertisingdemographics,competition,andavailabilityoffunding.These

processesneedtobeanalyzedrigorously,butwewillleaveallthattothe

managers.

OursitewillcaterforloversofbooksandDVDs.Itwillprovideuseful

contentandtrytobuildcommunity.Ourvisitorswillwanttoreadabout

thesethings,andcontributetheiropinions,buteachvisitwillbefairly

short-thiswillnotbeahugedatabaseinthestyleoftheInternetMovie

Database(www.imdb.com).Itwillbefundedbyadvertising,andwillrely

onrepeated(butfairlyshort)visitsfromitsreaders.

Wealsoneedtoconsiderconstraints.Thesearemorepractical.Oneof

themajorconstraintsthatthissitefacedwasthedevelopmentteam-the

memberswouldnevermeet,becausetheywereonoppositesidesofthe

world.Thismeantthatthedesignmustallowonedevelopertoworkon

sectionsofthesitewithoutinterferingwithotherdevelopersworkingon

differentsections.Butallofthesectionsneededtoeventuallywork

togethersmoothly.Inmostcasestheseparationbetweendeveloperswill

belessextreme,butgivingeachdevelopertheabilitytowork

independentlyisveryuseful.Weneedtodesignandbuildmethodsto

enablethis.

Sitedevelopmentneverreallyfinishes-sitestendtobetweaked

frequently.Anotherkeytosuccessfulwebsitesistodesigntheminaway

thatmakesmodificationeasy.Wewillneedtofindwaystodothis.

WewillcalloursiteThePhile.com,becauseitisasiteforlovers

ofbooks(bibliophiles)andDVDs(DVD-philes).It'salsoaplay

ontheword'file',becauseourwebsitewillbeadefinitive

sourceofinformation.



Chapter1Buildingan

ASP.NETWebsite

byMarco

BellinasoandKevin

Hoffman?

WroxPress?2002



TheDesign

Wehaveoutlinedwhatoursiteneeds-nowlet'slookathowwecan

provideit.Themainpointsraisedintheproblemsectionwere:

Enabledeveloperstoworkfrommanydifferentlocations

Buildamaintainable,extendablesite

Buildcommunity

Provideinterestingcontent

Providerevenuethroughadvertising

Encouragefrequentvisits

Let'sdiscusseachoftheseinturn.



WorkingFromDifferentLocations

Ourdevelopersneedtoworkonsectionsofthesitewithrelativelylittle

communication.Ourdevelopersareindifferentcountriessoface-to-face

meetingsareimpossible.Telephoneconversationscanbeexpensive,

anddifferenttimezonescauseproblems.

Weneedtodesignthesystemsothatdeveloperscanworkontheirown

sectionofthesite,knowingthattheywillnotdamagetheworkofothers.

Agoodwaytosolvethisistodevelopthesiteasaseriesofmodules,

witheachmodulebeingfairlyindependent.Ofcoursetherewillbeshared

components,butchangestothesewillberareandcanbedoneina

controlledway.Inthisbook,weworkinmodules.Wealsomakefrequent

useofcontrols.Thismeansthatcomponentsforapagecanbe

developedindependently,andeasily'droppedin'asneeded-changesto

theactualpagesofthesitearekepttoaminimum.



AMaintainable,ExtendableSite



Mostwebsiteshavenewfeaturesaddedquitefrequently.Thismeans

thatfromthestartthesiteneedstobedesignedtomakethateasy.

Workinginmodulesandusingcontrolsalreadygoessomewaytowards

this.Particularly,usingcontrolsmeansthatnon-programmerscanedit

thepagesofoursitemoreeasily-nearlyalltheyseeisHTMLcode.A

controljustlookslikeanotherHTMLtag.

Workinginmodulesmeansthatnewmodulescanbeaddedtothesiteat

anytime,withminimumdisruption.Allmodulesarefairlyindependent,so

newonescanbeadded-andchangesmade-prettyeasily.

Eachindividualmoduleneedstobeeasytochange.Agoodwaytodo

thisistoworkinlayers,or'tiers'.Wewillbeusingathree-layerdesignfor

mostmodules.Wehaveadatalayer,abusinesslayer,anda

presentationlayer.Datapassesfromdatalayertobusinesslayer,and

frombusinesslayertopresentationlayer,andbackagain.Eachlayer

hasajobtodo.Underneaththedatalayerisadatasource,whichitis

thedatalayer'sjobtoaccess.

Thedatalayerobtainsfairlyrawdatafromthedatabase(forexample,

"-10").Thebusinesslayerturnsthatdataintoinformationthatmakes

sensefromtheperspectiveofbusinessrules(forexample,"-10degrees

centigrade").Thepresentationlayerturnsthisintosomethingthatmakes

sensetousers(forexample,"strewth!It'sfreezing!").

It'susefultodothis,becauseeachlayercanbemodifiedindependently.

Wecanmodifythebusinesslayer,andprovidedwecontinuetoaccept

thesamedatafromthedatalayer,andprovidethesamedatatothe

presentationlayer,wedon'tneedtoworryaboutwiderimplications.We

canmodifythepresentationlayertochangethelookofthesitewithout

changingtheunderlyingbusinesslogic.

Thismeanswecanprovideversionsofthesitefordifferentaudiences.

Wejustneednewpresentationlayersthatcallthesamebusiness

objects.Forexample,providingdifferentlanguages:"zutalors!Commeil

faitfroid","allora,fafreddo",andsoon.

Weneedmethodstogetchangeswemakeontothelivesite.Thiscould



bethroughFTPuploads,butinmanycircumstancesitisbettertowork

throughawebinterface.

Wewillalsoneedtoolstoadministertheothersections-banproblem

users,addnewsarticles,andsoon.Thisisallpartofprovidinga

maintainablesite.



Community

Sitesgenerallybenefitfromallowingreaderstocontribute.Becauseour

siteisnotintendedforuserstospendhourslookingat,ourcommunity

featuresmustnotrequirealotofusers'time.

Therearetwowaysthatwewillbuildourcommunity:throughpollsand

forums.Pollsgiveuserstheopportunitytogivetheiropinioninasingle

click-sotheyrequireverylittletimefromtheuser,butcanmakeasite

seemfarmorealive.

Forumsenableuserstodiscusstopicswithotherusers.Messages

remaininthesystem,andrepliesareposted.Readerscanleaveapost,

andthencomebacklatertoseeiftherearereplies.Thisismore

appropriateforourpurposesthanachatroom,whichrequiresthereader

toconcentrateonthesiteforthewholedurationofthechat.

Communitycanreallygiveasitealifeofitsown.Overtime,strong

characters,heroes,andvillainsemerge.Manysitesdependentirelyon

community,andbecomeextremelypopular-forexample

www.plastic.com.

Foranyofthistowork,weneedtoidentifyusersandprovidethemwith

uniquelogons.Sooursystemwillneedsomeformofuseraccounts

system.



InterestingContent

Thecontentmostrelevanttoouruserswillbemovieandbookrelated

newsandreviews.Thiscontenttendstobehighlyrelevantforashort



periodoftime:afterastoryhasbroken,orimmediatelyafterarelease.

Oursitewillneedtoolstomanagenewsinthisway.

Anotherwaytoprovideinterestingcontentistogetsomebodyelseto

provideit!Thisispartofwhatwe'redoingwithourcommunitysection.

Partofthepurposeofbuildingcommunityistogetpeoplecontributing

content.



Advertising

Advertisinggeneratesrevenue(orinsomecasesitisusedtoexchange

bannerswithothersites).Weneedtodisplayadverts,andrecorddata

abouthowofteneachadverthasbeendisplayedandclickedon.

Wealsoneedtogatherinformationaboutwhattheusersofthesitelike,

sowecantargetouradvertisingcontent.Pollsandforumscanprovideus

withusefulinformationwhenfindingproductstoadvertise.

Thebiggestsitestargetindividualusersbasedontheirdemographicand

anyotherinformationgatheredaboutthem(forexample,Yahoo!and

Amazon.comtargetadvertisingandproductrecommendationstothe

demographicandbuyinghabitsofeachuser).Oursitealreadyhasa

fairlynarrowtargetdemographic,andisnotparticularlybig,sowedon't

needtodothis.



FrequentVisits

Agoodsitewillmakepeoplewanttoreturn.Ifthecontentiscompelling,

andthere'splentyofdiscussiongoingon,thenpeoplevisitagainand

again.

It'sstillagoodideatoremindusersfromtimetotime.Wewanttodraw

attentionbacktothesite,evenwhentheuserisn'tviewingit.Oneway

we'llbedoingthisisthroughane-mailnewsletter,whichgivesusers

usefulinformationandsubtlyremindsthemtovisitthesite.

WewillalsobuildaWindowsapplicationthatactsasanewsticker,with



automaticallyupdatingnewsheadlines.Userscanclickaheadlineto

viewthefullstoryonthesite.



Chapter1Buildingan

ASP.NETWebsite

byMarco

BellinasoandKevin

Hoffman?

WroxPress?2002



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Chapter 1: Building an ASP.NET Website

Tải bản đầy đủ ngay(0 tr)

×