Component Based Software Development

Preview:

DESCRIPTION

Talk on component based software development, presented in the eight Uruguayan .NET Meetup.

Citation preview

ComponentBasedSoftwareDevelopment

DiegoCardozo

github.com/diegocard

Agenda1. Motivation2. ¿WhatisCBSD?3. ComponentsvsObjects4. Wellknownapplications5. ¿HowdoCMSsfitin?6. Applyingthseconcepts

WebMatrixOrchardCMS

Warning:thistalkisaboutSoftwareEngineering

Motivation(1)IfGMhadkeptupwithtechnologylikethecomputerindustryhas,wewouldallbedriving$25.00carsthatgot1,000miles

tothegallon.

Motivation(2)Butyouwould...

Crashatleast2timesadayHavetobuyanewcareverytimeanewtrafficsignalisinstalledHavetolearntodriveagaineverytimeyoubuyanewmodel

¿Conclusion?OtherindustriesfollowdifferentapproachesTheygetverygoodresultsinareaswerewedon't.

Carindustry:agileprocess,complexproductthatisbuiltrapidly.Constructionindustry:muchhighercostassociatedtochange,buttheyanticipateitbetter.

¿Whatdootherindustrieshaveincommon?

TheyworkusingcomponentsHigherre-userateSimplifiestestingSimplifiesmaintenanceBetteroverallquality

Componentsdevelopedbythirdparties

ShorterdevelopmentcycleBetterROI

¿WhatisaSWcomponent?"Asoftwarecomponentisaunitofcompositionwithcontractuallyspecifiedinterfaceandexplicitcontext

dependenciesonly.Asoftwarecomponentcanbedeployedindependentlyandis

subjecttocompositionbythirdparts."

Szyperski,2002

7Criteria1. CanbeusedbyotherSWcomponents2. Canbeusedbyotherswithouttheinterventionofthe

authoringdeveloper(LikeCMS).3. Includesspecificationsforallofitsdependencies.4. Includesdocumentationofalltheofferedfunctionalities.5. Itsbehaviorcanbeunderstoodfromitsspecifications.6. Canbecoupledtoothercomponents.7. CanbeincorporatedtoaSWsystemrapidlyandsmoothly.

DisadvantagesClairvoyance:designacomponentwithoutknowledgeofitsfinaluser.Customization:itishardtocustomizeacomponentwithoutaccesstoitsimplementation.Lackofsupport:onceacomponentiscreatedandsealed,¿whomaintainsitandhow?

ObjectsvsComponentsObject Component

Polymorphism Yes No

Instantiation Late Aslateaspossible

Encapsulation Sortof Realandenforced

Inheritance Si Interfaceinheritanceandbinaryreuse

WellknownapplicationsLowlevel:COM(ComponentObjectModel)

Processcommunicationindifferentlanguages.NETprecursor

CORBAStandardcreatedbyOMGWidelyusedintheJavaworld

OtherapplicationsProgrammingforgraphicdesign

Paintermodel(1)

Paintermodel(2)Thereare2techniquestocreateimagesOneofthemisthepaintermodelYoutakeanelement(brush,pencil)anduseittocreateimagesfromscratch.Freestrokesareused.Naturalapproach.Ibelieveitistheperfectanalogyforhowwedevelopsoftware. 1. Webeginwithablankpage.2. Imaginetheproductasifitwerefinished.3. Implementthesolutionlinebyline.

Compositionmodel(1)

Compositionmodel(2)Itisaboutcreatingimagesfromexistingelements.Example:mosaicExample:drawachessboard.Ibelievethisistheapproachwemustfollowwhencreatingsoftware. 1. Takeknownandwelldefinedelements.2. Putthemtogetherinasmartway.3. Createonlythemissingcomponents.

Thereisanenormousamountofexistingcomponentsintheworldofsoftware.

PaintervscompositionOnemethodcanbefasterthantheother,dependingonthetypeofimageinvolved.Alsoconsiderwhichoneachievesabetterresult.Nevertheless,Ibelievethatmostproblemsinthesoftwareworldadjustbettertothecompositionmodel.

Enoughphilosophy...Concreteexample:

CreateawebsitefortheUruguayan.NETcommunityIncludeaforum

¿WhyuseaCMS?

TheyarefundamentallybasedaroundCBSD.Bothstructureandcontentaretreatedascomponents

Pages,images,posts,widgets,modules,etc.Hugecommunityandcomponentcatalogavailable.

MicrosoftWebMatrix(1)FreedevelopmentenvironmentbyMicrosoftLightweight:40MBoutoftheboxcomparedtoseveralGBfromVisualStudioDesignedforthecloudHandlesmanylanguagesandframeworks

ASP.NETPHPNode.js

IntegrateswithconGITandTFS

MicrosoftWebMatrix(2)VisualStudiofeelslikealaboratoryforcreatingsoftwareWebMatrixisidealforDSBC

Providescomponents:FrameworkgalleryIncorporatesNuGetpackagemanagerUsefulextensions

Isolatesframeworkfromcomponents

OrchardCMS(1)CompletelyOpenSourceRapidgrowthMVCArchitectureThismeansthatallcomponentsfollowaMVCarchitecture.

CreatingnewcomponentsissimpleComponentsareeasytounderstandandextend

OrchardCMS(2)Components

ContentModule

FeaturesThemesTemplates

ShapesWidgetsUsers,roles,permissions

ResourcesSlidesandcode:

github.com/diegocard/CBSD-presentationCBSDinMSDN(spanish):

http://msdn.microsoft.com/es-es/library/bb972268.aspx#ref07back

Greatrelatedpresentation(spanish):http://www.slideshare.net/ulicruz/desarrollo-de-software-basado-en-componentes

PaperComponent-BasedSoftwareEngineering–NewParadigmofSoftwareDevelopment(Crnkovic,Larsson)

Theend"Ithasbeenalongtimeincoming,buttheIndustrial

Revolutionofsoftwareisfinallyuponus.Specializationofresources,standardsforinterchangeableparts,andstreamlinedassemblytoolshavebeenusedinother

industriesforhundredsofyearstospeedthedevelopmentofhighlycomplexproducts.

Despitetheirubiquity,applicationoftheseconceptstothemodernsoftwareindustryisjustbeginning.."

BillGates,1997

Recommended