Lively Kernel canvas
* MIT license
*
* Includes enhancements by Scott Trenda
* and Kris Kowal
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.]]> 99 ? Math.round(L / 10) : L),
t: H < 12 ? "a" : "p",
tt: H < 12 ? "am" : "pm",
T: H < 12 ? "A" : "P",
TT: H < 12 ? "AM" : "PM",
Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
};
return mask.replace(token, function ($0) {
return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
});
};
}();
// Some common format strings
dateFormat.masks = {
"default": "ddd mmm dd yyyy HH:MM:ss",
shortDate: "m/d/yy",
mediumDate: "mmm d, yyyy",
longDate: "mmmm d, yyyy",
fullDate: "dddd, mmmm d, yyyy",
shortTime: "h:MM TT",
mediumTime: "h:MM:ss TT",
longTime: "h:MM:ss TT Z",
isoDate: "yyyy-mm-dd",
isoTime: "HH:MM:ss",
isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};
// Internationalization strings
dateFormat.i18n = {
dayNames: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
]
};
// For convenience...
Date.prototype.format = function (mask, utc) {
return dateFormat(this, mask, utc);
};]]>
LivelyHTML-SeminarReport28true
savefalsenulltruenull
addpapertruenulltruenullfalse
LivelyCodeDatabase24truetruetruefalsefalsefalsefalsefalsefalsefalse
TheLivelyKernelisaweb-baseddevelopmentenvironmentthatisincreasinglygainingpopularity.Itsserver-sidepersistencyiscurrentlybasedonSubversion.Asafile-basedrevisioncontrolsystem,Subversiondoesnotallowforamorefine-granularrevisioncontrolforJavaScriptmodules,classes,ormethods.ThispaperpresentsanalternativepersistencylayerbasedonCouchDBthatwasintegratedintotheLivelyKerneltoallowdeveloperstostoreJavaScriptcodeobjectsinadatabase.16truetruefalsefalsefalsefalsefalsetruefalsefalse4
\author{Tilman~GieseandMarko~Röder}\authorrunning{Giese,Röder}\institute{%Hasso-Plattner-Institut,Potsdam\\\email{\{tilman.giese,marko.roeder\}@student.hpi.uni-potsdam.de}}\maketitle106truetruefalsefalsefalsefalsetruefalse
SummaryandOutlook20truetruefalsetruefalsefalsefalsefalsefalsefalse
MotivationandGoals20truetruefalsefalsefalsefalsetruefalsefalsefalse
Withtheincreasingcapabilitiesandperformanceoftoday'swebbrowsersweb-baseddevelopmentenvironmentshavebecomepopular.Theapproachtodevelopapplicationswithinthebrowserwithoutanyadditionaltoolisveryintriguing.TheLivelyKernelissuchadevelopmentenvironmentthatencouragesdeveloperstoexplorethisnewhands-onwayofcreatingwebapplications.TheLivelyKerneliscurrentlybasedonSubversion\cite{subversion}asitspersistencylayer.TheSubversionrepositoryisdirectlyaccessedbythebrowsertoretrieveallnecessaryfiles,inparticulartheXHTMLandJavaScriptfilesthatcontaintheactualcodetobeexecuted.AsSubversionisafile-orientedversioningcontrolsystem,theversioninggranularityintheLivelyKernelisalsoafile.However,usingfilesasthesmallestentitiestocontainJavaScriptcodeentailsseveralshortcomings.ItalsohasaseriousimpactonhowJavaScriptcodecanbemaintainedbymeansofthebuilt-inLivelyKernelsourcecodebrowsers.ThefirstandforemostshortcomingofthisapproachisthatJavaScriptsourcecodehastobeparsedallthetimeinordertoprovideafine-granularviewonclasseswithinamoduleandmethodswithinaclass.SyntaxerrorsintheJavaScriptfilemightrendertheentirefileunparseableandthusnoclassesormethodsmightbevisibleinacodebrowser.ByjustrelyingonthemeansofJavaScriptsourcecode,itisalsoquitedifficulttointroducemetadataonclassesormethods(likedocumentationormethodcategories).Thecurrentapproachrequiresthedevelopertofollowcertainconventions,e.g.bydeclaringaclasspropertywithaparticularnameorbyaddingaspecialcommentontopofamethoddefinition.Andfurtherissuesarisefromfilesbeingtheentityofversioningcontrol.EverysmallchangetoamethodwillalwaysresultintheentirefilebeingsavedandassignedanewSubversionrevisionnumber.Thiscaneventuallyleadtoaveryhugedatabase.Butmoreimportantly,theconnectionbetweenchangesthatlogicallybelongtogetherislostaseachchangewillcreateanewSubversionrevision.Withoutspecificknowledgeofhowchangesweredoneitisthusimpossibletorevertbacktoaconsistentstate.Thegoalofthisprojectwastoprovideamorefine-granularrevisioncontrolforJavaScriptcodeobjects.AcodeobjectisasourcecodeartifactwithintheLivelyKernelenvironmentthathasasemanticalnotionofitsown.Asinglecodeobjectcanbecomposedofothersmallercodeobjects.Examplesofsuchcodeobjectsaremethods,classes,andmodules.ThecodeobjectsshouldthenbestoredinaseparatedatabaseratherthantheSubversionrepository.TheexistingLivelyKernelsourcecodebrowsersshouldbeextendedtoreadandwritecodeobjectswithoutthedevelopernoticingthechangeinpersistency.Aninterfaceshouldbeprovidedtoeasilyaccesscodeobjectsinthedatabase.TheJavaScriptsourcecodeshouldstillbeaccessibleasafileandmodulesshouldbeloadablefromthedatabaseinthesamewaytheywerepreviouslyloaded.Figure~\ref{goals}summarizesthechangeinpersistency.\begin{figure}[htbp]\begin{center}\includegraphics[width=8cm]{goals.png}\caption{\label{goals}PersistencyChange}\vspace*{-2em}\end{center}\end{figure}16truetruetruefalsefalsefalsefalsefalsefalsefalse39
Withtheworkdonesofar,therearethreelibrariestoenableCouchDBasoneofthepersistencylayersthattheLivelyKernelcanrelyon.Thesethreelibrariesare:theCodeDatabaseAPIwhichisbasedonthesimpleJavaScriptAPItointeractwithaCouchDBinstance,theCodeDatabaseBrowserwhichwascreatedontopoftheCodeDatabaseAPIandthesmalllibraryofcoreenhancementsoftheLivelyKerneltomakeCouchDBdatabasesavalidsourcetoloadandexecutesourcecodefrom.OntheCouchDBsidethereisonlyonedesigndocumentthatcontainsallthemap/reducefunctionstoletthecoreextensionandtheCodeDatabaseAPIquerythedatabase.AndthisdocumentcaneasilybeinstalledonanewCouchDBdatabasebysimplypointingtheCodeDatabaseAPIortheCodeDatabaseBrowsertothedatabaseURLandinstructingitto"livelyfy"thatdatabase.Toconcludebynowthereisatransparentreplacementofthecurrentpersistencyfromtheperspectiveofthesourcecodeandrevisionmanagement.Neverthelesstherearestillsomepointsmissingthatneedfurtherwork.OneofitisthattheentireLivelyKernelsourcecodehastobeimportedintoonedatabase.DoingthistherealsohastobedonesomecleanupandextensionworksincethecurrentJavaScriptcodeusedinsidetheLivelyKerneldoesnotonlyconsistofmodules,classesandmethods/attributesbutofsomeplainJavaScriptcodetocreatethebaseofthesystem(likethenamespacesetc.).FurthermoretherearenotonlyJavaScriptfilesthatmaketheLivelyKernelbutalsoXHTMLfilescontainingalltheelementsinsidea"world".EithertherehastobeawaytoconvertthatXHTMLfilestoCouchDBdocumentstooorthesefileshavetostayinsideaparallelSubversionrepository.Asfinalideasofwhatmightbecomingnext,therestillissomeworktodoontransactionsandabetterconflictresolutionwhensavingsourcecodetothecodedatabase.AlsothepreviouslydiscussedoptiontousedifferentrevisionsofthesamemoduleorclassandthetaggingofarevisionasversionmightaddagreatflexibilitytotheLivelyKernel.16truetruefalsefalsefalsefalsetruefalse25
SeminarWeb-basedDevelopmentEnvironments20truetruefalsefalsefalsefalsefalsefalsetruefalse
\bibliographystyle{splncs}\bibliography{references}1truetruefalsefalsefalsefalsetruefalsefalsefalse
%%%%$Id$%%10truetruetrue2
orderfalsenulltruefalsetrue
null
addfalsenulltruefalsetrue
null
astextfalsenulltruefalsetrue
null
setfile...falsenulltruefalsetrue
null
savefalsenulltruefalsetrue
null
%%%LocalVariables:%%%mode:latex%%%TeX-master:"Pape_2010_WDE_TeXParagraphLayout"%%%End:103truetruetrue
Implementation20truetruetrue
RelatedWork20truetruetrue
High-LevelArchitecture16truetruetrue
Discussion20truetruetrue
KernelExtension16truetruetrue
CodeDatabaseBrowser16truetruetrue
CodeDatabaseAPI16truetruetrue
ThefollowingsectionspresentoursolutioninmoredetailandexplainhowitintegratesintotheLivelyKernel.Theoverallarchitectureisbrieflydescribedfollowedbyanoverviewofthethreemajorpartsofthesolution:theCodeDatabaseAPItoaccessthedatabase,theCodeDatabaseBrowserasthetooltodevelopapplicationsandtheLivelyKernelcoreextensionthatallowsdeveloperstoloadcodefromthedatabase.163truetruetrue
\label{HighLevelArchitecture}Asapresetrequirement,CouchDB\cite{couchdb}hadbeenchosenveryearlyasthedatabasetechnologytostorecodeobjects.CouchDBandSubversionhaveadifferentnotionofrevision,thereforethetermneedsclarification.Acodeobjectrevisionisaparticularpersistentrepresentationofacodeobjectataspecificpointintime.EachcodeobjectrevisioncorrespondstoaparticularCouchDBdocument.Acodeobjectrevisionisidentifiedbyacodeobjectrevisionnumberthatissequentiallyincrementedforeachnewrevisionstartingwith1forthefirstrevision.Therevisionsarecollectedinacodeobjectrevisionhistory.Codeobjectrevisionscanbeflaggedasdraftsmeaningtheyarenotvisibletodevelopersunlessspecificallyrequested.Listing~\ref{ClassRevision}showstheCouchDBdocumentforaclassrevision.Therevisionpropertiesareself-explanatory.CouchDBdocumentsareJavaScriptobjectsinJSONform.169truetruetrue
[label=ClassRevision,caption=CouchDBDocument:ClassRevision,captionpos=t]{"_id":"Revision::25::TestModule::TestClass","_rev":"25-2a4bb26e8b88a5447215e71e942f6870","type":"class","name":"TestClass","documentation":"Thisisaclassfortestingpurposes","superclass":"Object","methods":["method1","method2","method3"],"module":"TestModule"}1412truetruetrue
Inordertogroupseveralcodeobjectstogether,thereisalsotheconceptofachangeset.Asetofchangestoasetofcodeobjectsiscalledachangesettherebychangesetimplicitlydefinesalogicalunitofwork.Persistingachangesetinthedatabasewillcreateachangesetrevision.Similarlytoacodeobjectrevisionhistorythereisalsoachangesetrevisionhistorythatkeepstrackofallthechangesets.Listing~\ref{ChangeSetRevisionHistory}showsanextractoftheCouchDBdocumentthatrepresentsthechangesetrevisionhistory.Itstoreswhocommittedthechangesetandwhichcodeobjectswereinvolvedrespectivelywhatactionswereperformedonthesecodeobjects.165truetruetrue
[label=ChangeSetRevisionHistory,caption=CouchDBDocument:ChangeSetRevisionHistory,captionpos=t]{"_id":"ChangeSetHistory","_rev":"200-c4a81c3b50ac4849e5595554a796e4fb","currentRevision":58,"revisionHistory":[...{"revision":36,"author":"m.roeder","date":"2010-07-20T14:07:55Z","message":"mycommitmessage","objects":[{"name":"TestModule2","revision":1,"action":"add"},{"name":"TestModule2::TestClass","revision":1,"action":"add"},{"name":"TestModule1","revision":2,"action":"update"}]},...]}1432truetruetrue
InordertoavoidnameclasheswhenstoringdocumentsinCouchDB,therearethefollowingconventionsfordocumentidentifiers:161truetruetrue
[label=DocumentIdentifiers,caption=CouchDBDocumentIdentifiers,captionpos=t]-Revision::{RevNumber}::{ModuleName}[::{ClassName}[::{MethodName}]]-RevisionHistory::{ModuleName}[::{ClassName}[::{MethodName}]]-ChangeSetHistory143truetruetrue
TheCodeDatabaseAPIistheinterfacetoallcodeobjectsstoredinthedatabase.Itreflectstheconceptsdescribedintheprevioussection.Figure~\ref{ClassDiagram}showstheclassesthatareinvolved.\begin{figure}[htbp]\begin{center}\includegraphics[width=11cm]{classes.png}\caption{\label{ClassDiagram}CodeDatabaseAPI:ClassDiagram}\vspace*{-2em}\end{center}\end{figure}Themainentrypointistheclass\texttt{Repository}.Itprovidesmethodstoretrievecodeobjectsandtocreateanewchangeset:1610truetruetrue
[label=RepositoryInterface,caption=\texttt{Repository}Interface,captionpos=t]#toretrieveasinglecodeobjectgetCodeObject(type?,name+,includeDrafts?)e.g.getCodeObject(CDB.Module,'TestModule')e.g.getCodeObject('TestModule','TestClass',true)#tolistcodeobjectslistCodeObjects(type,name+,includeDrafts?)e.g.listCodeObject(CDB.Method,'TestModule::TestClass')#tocreateanewchangesetcreateChangeSet()1411truetruetrue
Atypicalprogramflowisdepictedinfigure~\ref{ProgramFlow}.First,areferencetothecodedatabaserepositoryiscreatedalongwithanewchangeset.Afterwards,thedatabasecanbequeriedforcodeobjectsusingeitherthe\texttt{getCodeObject}or\texttt{listCodeObjects}method.Beforeacodeobjectcanbemodified,ithastobeaddedtothechangeset.Savingthecodeobjectwillpersistallitspropertiesinthedatabaseusingadraftrevision.Codeobjectscan,ofcourse,besavedseveraltimesuntilthechangesetisfinallycommitted.\begin{figure}[htbp]\begin{center}\includegraphics[width=11cm]{flow.png}\caption{\label{ProgramFlow}TypicalProgramFlow}\vspace*{-2em}\end{center}\end{figure}Draftrevisionsofcodeobjectsaresnapshotsthatdonotnecessarilyhavetobeinanexecutablestateorconsistentwithothercodeobjects.SavingadraftrevisionwillcreateanewCouchDBdocumentfortherevisionandmodify(orcreateiftheobjectdoesnotexistyet)theCouchDBdocumentforthecodeobjectrevisionhistory.Editingconflictswithotherdevelopersaredetecteduponchangingtherevisionhistory\footnote{WheneveraCouchDBdocumentisupdatedthedocumentrevisionhash(whichisaCouchDBidentifier)ofthepreviousrevisionhastobeprovided.Ifanotherrevisionwasaddedinthemeantime,CouchDBcanthusdetectanupdateconflict.}.Whenthechangesetiscommitted,consistencyischeckedmoreproperly,forexampleaclassalsohastobepartofthechangesetifamethodwasaddedtoit.Afterallconsistencycheckshavesuccessfullypassed,thedraftflagisremovedfromthelatestrevisionsofallcodeobjectsandanewchangesetrevisioniscreated.Listing~\ref{ExampleProgram}showsasmallexamplethataddsanewmethodtoanexistingclass,savesandcommitsthechanges.1621truetruetrue
OneimplementationthatusestheCodeDatabaseAPIistheCodeDatabaseBrowser.ItisthetoolthatletsadeveloperbrowseandedittheLivelyKernelsourcecodestoredinsideaCouchDBdatabase.Bygivingtheuserthiskindoftool,thereisnoneedtodirectlyinteractwiththedatabase.Everythingthatneedstobedone--likeaddingorremovingacodeobject(e.g.amethod)andsettingitsattributesorcontents--canbedonewiththebrowser.Figure~\ref{CodeBrowser}showstheCodeDatabaseBrowserandnamesitsparts.\begin{figure}[htbp]\begin{center}\includegraphics[width=1.0\textwidth]{codeBrowser.png}\caption{\label{CodeBrowser}TheCodeDatabaseBrowser}\vspace*{-2em}\end{center}\end{figure}TomakeuseofthelookandfeeloftheLivelyKernelbrowser-style,theCodeDatabaseBrowserwasbuiltontopofalreadyexistingclassesthatareusedtoshowtheJavaScriptfilesfromtheSubversionrepository.Usingthisbasicbrowserthereisnotonlyacommonlookandfeelbutalsothesameunderstandingofhowtorepresentandworkwitheachcodeobject.Thusitwillbeeasytointegratewiththedefaultcodebrowserorevenreplaceitinoneofthenextsteps.AspecialtyoftheCodeDatabaseBrowserisitsdifferentiationbetweensavingandcommittingchanges.Derivedfromthetwowayscodeobjectscanbestored--eitherasdraftorasacommitwhensemanticallygrouped--therearealsotwowaystopersistchanges.Thefirstoneisthedefaultactionwhichiscarriedoute.g.afterchangingamethodandpressingthekeyboardshortcuttosave(dependingontheoperationsystemthatcouldbeCMD+S).Thisinvokesthe\texttt{save}methodontheaffectedcodeobjectsandstoresthemasdraftsinsidethedatabase.Havingthe\texttt{draft}statusthechangeshaveonlybeensafelypersistedbuttheydonotaffectthecurrentlyloadedandexecutedcode.Ifthedeveloperwantstoactivatethechangesinstead,thenthecommitbuttonhastobepressedandallthechangesdoneinsidethecurrentchangesetwillbecommittedandactivated.Sincethedevelopermightnotalwayswanttoseethechangesmadeasdrafts,thedraftbuttonswitchesthebrowsermodebetweenonlydisplayingactivatedcodeandalsodisplayingdrafts.Addingandremovingamodule,classormethodwhichcanbedonebythe"Addmodule"buttonandthebrowsersubmenusautomaticallycreatesadraftforthecorrespondingcodeobject.16truetruenullfalsetruefalsefalsefalsefalsefalsefalse30
InthelasttwosectionswefocusedonhowtomanagecodeobjectswiththeCodeDatabaseAPIandtheCodeDatabaseBrowser.InthissectionwewillexplainhowthecodethatisstoredinsideCouchDBcanbeloadedintoandexecutedinsidetheLivelyKernel.Listing~\ref{ModuleExample}showsthestructureofamodulethatcanbeloadedfromtheSubversionrepositoryintotheLivelyKernelsystem.Themoduleparametercreatesanewmoduleandnamespacecalled\texttt{lively.Example}thathasdependenciesto\texttt{lively.Tools}and\texttt{lively.Helper}.Insidethatnamespace,aclassdefinitioncreatesthenewclass\texttt{SubClass}whichisderivedfrom\texttt{SuperClass}.Theclass\texttt{SubClass}canhavemethodslike\texttt{initialize}and\texttt{aMethod}andattributeslike\texttt{documentation}.16truetruenullfalsetruefalsefalsefalsefalsefalsefalse9
TheprevioussectionsintroducedthechangeswemadetotheLivelyKerneltomakeituseaCouchDBdatabaseasa(second)persistencylayer.NowthereshallbeadiscussiononthedecisiontouseCouchDBasarevisioncontrolsystem(RCS)andtheadvantagesanddisadvantagewediddiscoverworkingonit.CouchDBitselfisoneofthenewdatabasetechnologiesthatarosewithintheNoSQLmovement.Itsdocument-orientedstyleandtheuseofJavaScripttodefinequeries(basedonthemap/reducealgorithm)makesitfarmoreappropriatetostorethesourcecodeoftheLivelyKernelinsideitthanarelationaldatabase.However,itssimplekey-documentstoragehasalsosomedisadvantageswhenbeingusedasRCSforobject-orientedsourcecodebecausenowadayseveryobject-orientedprogramminglanguagehassomekindofnamespaceconcept.SotheLivelyKernelbuiltuponJavaScripthasthattoo:methodsandattributesbelongtoaclass,classesbelongtoamoduleandmoduleshaveapath-likenamespacestructure.Tosupportthatwehadtocomeupwithamappingofthiswholestructuretoasinglekey(seesection~\ref{HighLevelArchitecture}forthat).Anotherimportantpointwhichwasalreadymentionedishowtomanagetherevisions.AtfirstwecompletelywantedtorelyonwhatCouchDBcallsadocumentrevisionforourcodeobjects.Doingthisandstoringacodeobject(e.g.amethod)insideonlyoneCouchDBdocumentshouldleadtocodeobjectrevisionsstoredasdocumentrevisions.WhatwedidignorefollowingthisapproachwasthatCouchDBrevisionsarenotrevisionsasinRCSs.OldrevisionscouldforexampleberemovedwhencompactingadatabaseoromittedmakingabackupcopytoanotherCouchDBinstance.Thissurelyisunwantedwhenstoringsourcecodewhereonedayyoumightgobackintimeandrestoreanoldversionorusemultipleversionsofthesamefile/libraryindifferentpartsofthesysteminparallel.Sotogetfullypersistentrevisionsweendedupwitharevisioningsystemthatstoresadocumentforeachrevisionofacodeobjectwhichwasoneoftwopossibleideas\cite{couchio}.AtlastweneededasimpleandefficientwaytoreconstructJavaScriptcodefromthecodeobjectsstoredinsidetheCouchDB.ThisisapointwhereCouchDBagaincanshowitsadvantagesofdocumentstorage.Usingmap/reduceinsideamixtureofviewsandlists(twoofthequeryingtechniques)wewereabletoconstructJavaScriptfilesformodulesthatlookexactlythesameasmodulesthatarestoredasfilesinsidetheSubversionrepository.Asanalternativetousingmap/reducecodetoconstructtheJavaScriptfiles,atemplate-basedapproachthatisalsosupportedbyCouchDBcouldhavebeentaken.ButaslongastheresultingstructureoftheJavaScriptfilesisthatsimplecreatingatemplatewouldjustbemoreoverhead.However,inbothcasestheresultingCouchDBlistscaneasilybeaccessedbyaURLwhichbynowistheaccessparadigmforSubversionfilestoo.ThereforenodeepchangesinsidetheLivelyKernelhadtobedonetoexecutesourcecodethatcomesoutoftheCouchDB.1631truetruenullfalsetruefalsefalsefalsefalsefalsefalse
[label=ExampleProgram,caption=ExampleProgram,captionpos=t]varrep=newCDB.Repository();varcs=rep.createChangeSet();varklass=rep.getCodeObject(CDB.Klass,'TestModule,'TestClass');varmethod=newCDB.Method('myNewMethod');klass.addMethod(method);method.documentation='Putherewhatthemethoddoes';method.source='function(){...}';cs.add(klass);cs.add(method);klass.save();//savesthechangesasdraftmethod.save();cs.commit();//commitsthechanges1417truetruetrue
ThroughouttheCodeDatabaseAPIerrorconditionsaresignaledusingexceptions.Forexample,\texttt{getCodeObject}willthrowan\texttt{ObjectNotFoundException}ifthespecifiedcodeobjectisnotinthedatabase.\text{commit}canthrowa\texttt{ConsistencyException}ifanyoftheconsistencyconstraintsarenotmetor,likealldatabaseoperations,a\texttt{DatabaseException}ifthereistechnicalproblemwiththedatabase.163truetruetrue
Ourgoalwastoextendthecurrentcoresystemtoloadsourcecodefromthecodedatabaseinthesamemanner.Soweintroducedanewprefixforallthesourcecodethatisloadedfromadatabase.Thisprefixstartswitha\$-signwhichisfollowedbythenameofthedatabaseandadot.Sotheprefixedmodulenameforthemoduleoflisting~\ref{ModuleExample}wouldlooklike\texttt{\$code\_db.lively.Example}whenloadedfromthecodedatabase.Inthiscase\texttt{code\_db}isthedatabasenameofaCouchDBdatabasecontainingLivelyKernelsourcecode.Furthermorethesamestyleofreferencescanbemadeinsiderequirementsandwhensubclassing.ThisallowsadeveloperoftheLivelyKerneltoadapttothenewpersistencylayermoreeasily.WhatisdonewhentheLoaderoftheLivelyKernelcomesacrossoneofthenewprefixedmodulereferencesisthattherequestofloadingtheJavaScriptfilefromaURLismodifiedtonotusethecurrentSubversionrepositorybuttheCouchDBinstancethathasbeenconfigured.OnthatCouchDBtheselecteddatabaseisqueriedforalist(oneofCouchDB'squeryingtechniques)thatbuildsaJavaScriptfilewiththesamekindofmodulestructureusedbytheLivelyKerneluntiltoday.1613truetruetrue
[label=ModuleExample,caption=Exampleforthemodulestructure,captionpos=t]module('lively.Example').requires('lively.Tools','lively.Helper').toRun(function(example,tools,help){SuperClass.subclass('lively.Example.SubClass',{documentation:'ThisisasubclassofSuperClass.',initialize:function($super){...},aMethod:function(arg1,arg2){...},...});...});1416truetruetrue
LikeotherrevisioncontrolsystemssuchasENVY/Developer\cite{envydeveloper},theLivelyCodeDatabaseprovidesthedeveloperwithatoolsetthatisimplementedonthecoresystemtohelpwithconfigurationmanagementandversioncontrol.Withasimilartypeofstructuringcodeobjects--modules,classandmethods--andabrowsertodevelopandmaintaintheseobjectstheCodeDatabaseenableschangesonthemethodlevel.UnlikeENVY/Developerourapproachdoesnothavecomponentownershipbutanauthorforeachrevsion.IncontrasttoRCSlikeSubversion\cite{subversion},GIT\cite{git}orMercurial\cite{mercurial},ourCodeDatabaseontopofaCouchDBdatabasedoesnotusefilesasthefinestgranularityforsourcecodebutinsteaditbreaksitdownintomodules,classesandmethods.Allthesepartsareseparatlyversionedandkepttogetherbyanencapsulatingchangeset.Sotherearelessconflictsifmorethanonedeveloperisworkingonthesamepartofthesystem.WeareworkingwithrevisionssimilarlytoPerforce\cite{perforce}intermsoflettingtheserverhaveadatabasewithmetainformationontheversionedsourcecode(e.g.revisionnumbersandrelationsbetweendifferentrevisions)andstoringthesourcecodeasseparatedocuments.Additionallywehavechangesets(thatarecalledchangelistsinPerforce)thatgroupmultiplechangesoncodeobjectsandnametheactionthatiscarriedout(like\texttt{added},\texttt{deleted},\texttt{updated}).However,wehaveamuchfinergrainedlookoncodeobjectsaswedonotusefilestostorethesourcecode.1617truetruenullfalsetruefalsefalsefalsefalsefalsefalsetrue
false
todo-generatereference-generatewholetext-bettermenuoptions-images4
Log:http://lively-kernel.org/nodejsLaTeX/LaTeXServerLog
Wikicontroltruetrue
sourcedir:falsenulltruefalse
http://www.lively-kernel.org/repository/webwerkstatt/ProjectSeminar2010/TR/truetruefalse
maintexfile:falsenulltruefalse
CodeDB/GieseRoeder_2010_WDE_CodeDB.textruetruefalse
URLforPDF:falsenulltruefalse
seminarReportHTML.pdftruetruefalse
openPDF:falsenulltruefalse
X18nullfalsetruetruefalse
generatePDFfalsenulltruefalsefalsetrue
falsenull
truefalsenull
nullfalsetruenullfalse
PDFgeneratorfalsenulltruefalse
false
false
falsenullfalsefalsenullnullnullnullfalse
null230
"]]>