Ohjelmiston rakenne

Johdanto

Theso-calledmodulereferstoarelativelyindependentcollectionofprogramobjectssuchasdatadescriptionsandexecutionstatements.Eachmoduleintheprogramneedstobenamedseparately,andaccesstothespecifiedmodulecanberealizedthroughthename.Inhigh-levellanguages,modulesareembodiedasfunctions,subroutines,procedures,etc.Amodulehasfourcharacteristics:input/output(interface),function,internaldata,andprogramcode.Theinput/outputisusedtorealizethedatatransmissionbetweenthemoduleandothermodules,thatis,theoriginaldatarequiredbythemoduleistransferredandtheresultdataisobtainedfromthemodule.Functionreferstotheworkdonebythemodule.Theinput/outputandfunctionsofthemoduleconstitutetheexternalcharacteristicsofthemodule.Internaldatareferstoalocalquantitythatcanonlybeusedinsidethemodule.

Someprogramshaveasingle-modulestructure,andsomehaveamulti-modulestructure.Thesemodulesareinseparableinthelogicoftheprogram,canbewrittenindifferentprogramminglanguages,canberespectivelycompiledbythecorrespondingcompiler,canbecombinedwithotherprogramunitsandloadedintothecomputertorun.Duetotheneedtowritelargeprogramsandmodulescanbeusedmultipletimes,modularizationisagoodmethod.Alargeprogramcomposedofasetofmodulescanhavethreestructures,namelysequentialstructure,concurrentstructureanddistributedstructure.Theprogramofsequentialstructureistheoldest,andtheprogramminglanguageusedissequentialprogramminglanguage,suchasALGOL,FORTRAN,Candsoon.Theprogramoftheconcurrentstructureiscomposedofseveralmodulesthatcanbeexecutedatthesametime.Thesemodulescanbeexecutedinparallelonmultipleprocessors,ortheycanbecross-executedonthesameprocessor.Theprogramminglanguageusedisaconcurrentprogramminglanguage,suchasconcurrentPASCAL,Modula-2,etc.Theprogramofthedistributedstructureiscomposedofseveralmodulesthatcanberunindependently.Thesemodulescanbedistributedinadistributedsystemandrunonseveralcomputersatthesametime.Theprogramminglanguageusedisthedistributedprogramminglanguage.Forlargeprograms,itcanalsobeamixtureofthesethreestructures.

WEB-ohjelmistorakenteen periaatteet

Ohjelmistorakenteen suunnittelun heuristiset säännöt

(1)Moduulin toimintojen parantaminen

PerformprescribedfunctionsPart;errorhandlingpart;whendataneedstobereturnedtothecaller,returnthecorrectendflag.

(2) Eliminoitu monistustoiminto

(3)Limittheinfluenceofthemodulewithinthecontrolrangeofthemodule

(4) Syvyys, leveys, tuulettimen ulostulo Kohtalainen ja tuuletin sisään

(5)Kohtalainen moduulikoko

Moduleistoolarge:comprehensibilityisreduced.Themoduleistoosmall:thecostismorecomplexthantheeffectiveoperatingsysteminterface.

(6)Vähennä moduuliliitännän monimutkaisuutta

Theinterfacetransmissioninformationshouldbesimpleandconsistentwiththemodulefunction.

(7)Moduulin toiminta on ennakoitavissa

Themoduleisregardedasablackbox,thesameinputproducesthesameoutput,anditsfunctionispredictable.Thefunctionofthemodulewithinternalstatemaybeunpredictable.Difficulttounderstand,difficulttotest,anddifficulttomaintain.

(8) Vältä kytköksissä olevia moduuleja

Preventbranchesorreferencesinthemiddleofmodules(forcontentcoupling).

(9)Thesoftwaremustbepackagedaccordingtodesignconstraintsandportability

Packagingreferstothetechnologyusedtoassemblesoftwareforaspecificenvironment.

Hakemistorakenne on selvä

Hakemistorakenne on selvä,nottoodeeporcomplicated.Itisbettertousearelativeaddressforthepath.

WhatkindofWhatkindofcontentisplacedinthedirectory,sothatitiseasytomanage,sothatthedirectorystructureoftheWEBprogramisclear,andyoucanknowwhatfunctionmodulesandcontentarestoredinacertainfolderataglance.Ifyoustoreitcasually,youwillneverknowwhatacertaindirectoryisforforalongtime.Forexample,executablefilesthatarefrequentlyusedshouldbestoredintherootdirectoryofthe(projectrootdirectory).Thisismainlytofacilitateunderstandingofitsfunction,andalsotoreducetheinputofaddresscharactersintheprogram.Thepicturesusedbytheprogramarestoreduniformlyintheimagesdirectoryundertherootdirectory.Iftheprojectislargerandhasmorebranches,youcancreateadirectorynamethatalsobranchestheprograminthedirectorytostoretherelevantpicturecontent.Theconfigurationfilesoftheprogramandcommoncommonfunctionlibraryareplacedintheincludedirectory,andtheextensionofthefunctionlibraryfilestoredinthisdirectoryshouldbenamed:.phpmustnotbenamed.inc.iniandotherfileswithextensions,Themainreasonistopreventthistypeoffilefrombeingavailableforuserstodownload,ortoconsultthesourcecodecontent,sothatitisconvenientandcleartocall.Thetemplatefilesshouldbestoredinthetemplatesdirectoryundertherootdirectorywiththeextension.html.Iftheprojectislargeandtherearemanycategories,thetemplatefilescanbestoredinthelowerdirectory.Temporaryfilesarestoredintherootdirectorytmpdirectory.Thisdirectoryisusuallysettobereadableandwritablebyanyone.Theuseofrelativeaddressesismainlytofacilitateprogramtransplantation.

Nimeäminen sopivasti

Thenamingisbestbasedonwhattheprogramisusedfor.Ifawordneedstobedescribed,uselowercasewordstonameit.Ifmorethanonewordcanbeusedtorepresentit,connectthelowercasewordswithanunderscore.Notethatthenameshouldnotbetoolong,whichisinconvenient.Althoughitcanexpressmoreclearly,itisdifficulttotype.Thefunctionnamingintheprogramcanalsobethesame.

Frequentlychangingcontentandinterfacemakethetemplatebetter

Frequentlychangingcontentandinterfaceusetemplatebetter,ifitismadeaccordingtothetraditionalproduction,theHTMLpagecontentisplacedintheprogramwhenprocessinginput,Itismoretroublesometochangetheprogram,whichmaycausegreaterinconvenience.

Julkisen tiedon yhtenäinen tallennus

Julkisen tiedon yhtenäinen tallennus,thisismainlyfortheconvenienceofthemostcommonfunctionsthatcanbecalledduringteamdevelopment,withouteverydeveloperhavingtocopyAcopyorwriteacopyofitandstoreitintheprogramfile.Thiswastesspaceandisnotveryefficient.

Sisällytä tiedostoja ei voida upottaa liikaa

Sisällytä tiedostoja ei voida upottaa liikaa.Thisisbecauseeverytimetheprogramincludesafile,itneedstobeopenedandread.ThisisIttakestime,andthatistosay,youmayencounterbugsthatarehardertofindwhenprocessingpaths.

Älä tallenna liikaa sisältötiedostoja hakemistoon

Ifthefilesarelargeandlarge,itisbesttodividethemintodirectoriesanddisks.

Tietorakenteet tulisi suunnitella järkevästi

Tietorakenteet tulisi suunnitella järkevästi,conciselyandconcisely.

Tietojen vahvistuksen tulisi olla palvelimen puolella

Tietojen vahvistuksen tulisi olla palvelimen puolella,butthishasitsdisadvantages,thatis,whentheamountofdataislarge,theserverwillloadRunningandauditingdataintegritycancosttimeandsystemresources.Ontheclientside,itwillnotoccupytoomanyresourcesoftheserver,becauseitoccupiestheresourcesoftheuser.

Connectingtothedatabaseislate,anddisconnectingisearly

Connectingaslateaspossibleanddisconnectingassoonaspossiblecanminimizetheuseofsystemresourcesandprovideconditionsforthenextconnection.

Käytä SESSIONia ja COOKIE:tä vähänmahdollisimman

Käytä SESSIONia ja COOKIE:tä vähänmahdollisimman,becausetheuseofSESSIONtakesupsystemresources,andSESSIONisstoredontheserverside,andeachreadinSESSIONThedataismoreexpensive.Althoughcookiesdonotoccupyserverresources,cookiesarenotverysafe.

Related Articles
TOP