Структура софтвера

Увод

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.

Принципи структуре ВЕБ софтвера

Хеуристичка правила за дизајн структуре софтвера

(1) Побољшање функција модула

PerformprescribedfunctionsPart;errorhandlingpart;whendataneedstobereturnedtothecaller,returnthecorrectendflag.

(2) Елиминисана функција умножавања

(3)Limittheinfluenceofthemodulewithinthecontrolrangeofthemodule

(4)Дубина, ширина, умерено испуштање и вентилатор

(5)Умерена величина модула

Moduleistoolarge:comprehensibilityisreduced.Themoduleistoosmall:thecostismorecomplexthantheeffectiveoperatingsysteminterface.

(6) Смањите сложеност интерфејса модула

Theinterfacetransmissioninformationshouldbesimpleandconsistentwiththemodulefunction.

(7) Функција модула је предвидљива

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

(8)Избегавајте модуле повезане са дилом

Preventbranchesorreferencesinthemiddleofmodules(forcontentcoupling).

(9)Thesoftwaremustbepackagedaccordingtodesignconstraintsandportability

Packagingreferstothetechnologyusedtoassemblesoftwareforaspecificenvironment.

Структура именика је јасна

Структура именика је јасна,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.

Именовање прикладно

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

Frequentlychangingcontentandinterfacemakethetemplatebetter

Frequentlychangingcontentandinterfaceusetemplatebetter,ifitismadeaccordingtothetraditionalproduction,theHTMLpagecontentisplacedintheprogramwhenprocessinginput,Itismoretroublesometochangetheprogram,whichmaycausegreaterinconvenience.

Унифиедсторагеофпублицинформатион

Унифиедсторагеофпублицинформатион,thisismainlyfortheconvenienceofthemostcommonfunctionsthatcanbecalledduringteamdevelopment,withouteverydeveloperhavingtocopyAcopyorwriteacopyofitandstoreitintheprogramfile.Thiswastesspaceandisnotveryefficient.

Инцлудефилесцаннотбеембеддедтоомуцх

Инцлудефилесцаннотбеембеддедтоомуцх.Thisisbecauseeverytimetheprogramincludesafile,itneedstobeopenedandread.ThisisIttakestime,andthatistosay,youmayencounterbugsthatarehardertofindwhenprocessingpaths.

Немојте складиштити више датотека садржаја у директоријуму

Ifthefilesarelargeandlarge,itisbesttodividethemintodirectoriesanddisks.

Структура података треба да буде дизајнирана разумно

Структура података треба да буде дизајнирана разумно,conciselyandconcisely.

Верификација података треба да буде на страни сервера

Верификација података треба да буде на страни сервера,butthishasitsdisadvantages,thatis,whentheamountofdataislarge,theserverwillloadRunningandauditingdataintegritycancosttimeandsystemresources.Ontheclientside,itwillnotoccupytoomanyresourcesoftheserver,becauseitoccupiestheresourcesoftheuser.

Connectingtothedatabaseislate,anddisconnectingisearly

Connectingaslateaspossibleanddisconnectingassoonaspossiblecanminimizetheuseofsystemresourcesandprovideconditionsforthenextconnection.

Користите СЕССИОН анд ЦООКИЕ што је мање могуће

Користите СЕССИОН анд ЦООКИЕ што је мање могуће,becausetheuseofSESSIONtakesupsystemresources,andSESSIONisstoredontheserverside,andeachreadinSESSIONThedataismoreexpensive.Althoughcookiesdonotoccupyserverresources,cookiesarenotverysafe.

Related Articles
TOP