View
220
Download
0
Category
Preview:
Citation preview
7/28/2019 Ruby on Rails Garrick
1/32
RubyonRailsRapidDevelopment,ReducedBudgets,andResponsiveChange
MaxGarrick
Network&AcademicCompungServicesUniversityofCalifornia,Irvine
mgarrick@uci.edu
7/28/2019 Ruby on Rails Garrick
2/32
ValueProposion
Economicdownturn Hiringfreeze Sameoldcrustywebapps Sameuserrequests Rails,theagilewebdevelopmentframework,canhelpyourapidlydeliveronthesegrowingcampusneeds
anddevelopersmayevenenjoyusingit!
7/28/2019 Ruby on Rails Garrick
3/32
RailsHype
AlotofhypesurroundingRails Someexamplesontheweb:
TwierBasecamp43thingsBackpack,ODEO,AListApart,Github,YellowPages,etc
However,fewexamplesofprovenenterpriseRailsappsinhighereducaon
7/28/2019 Ruby on Rails Garrick
4/32
RailsAppatUCI
IwillshowyouhowUCIbuilta:ScalableFullyredundant
LoadbalancedFeaturerichCampuswideOnlinefacultyrecruitmentapplicaon
BuiltonRailsandinproduconforoveroneyear
7/28/2019 Ruby on Rails Garrick
5/32
RecruitAppOverview
ItwasDecember,2006
Had:OldPHPwebappforrecruingfaculty,developediniallybyI&CS,tweakedforwideradopon
Had:StaffwithPHP&MySQLexperienceNeeded:Arewrienappthatcouldscaleuptomeettheenrecampussneeds
7/28/2019 Ruby on Rails Garrick
6/32
7/28/2019 Ruby on Rails Garrick
7/32
ArchitecturalNeed
Oldercode Changestocodebaseweremeconsuminganderrorprone
Lileseparaonofbusinesslogicfrompresentaon
Patchedupsecurityvulnerabilies
7/28/2019 Ruby on Rails Garrick
8/32
Challenge:Howdowegetthere?
Challenge:Howdoweaccommodatetheseneeds?
Morespecifically:
Howdowedeliveranenterprisewebapp
thatdeliversonourcampussneedsin8
monthsandwithlimitedstaff?
7/28/2019 Ruby on Rails Garrick
9/32
WeNeededaFramework
Novendororopensourceappsuitedourneeds
Codingfromscratchisslow Weneededamodernframeworktojumpstartourappdevelopment
Weneverusedaframeworkbeforeremember:PHP,December,2006
7/28/2019 Ruby on Rails Garrick
10/32
WhichFramework?
Weevaluatedafewframeworksthatwouldfitourskillset:
PHP:CakePHP,PHPonTRAX,Zend,etc
SmalldevelopercommuniesatthemeZendframeworkmostpromising,butbetaAlloftheseframeworksemulateRails
Whynotjust
userails?
7/28/2019 Ruby on Rails Garrick
11/32
WhyNottoUseRails
WeheardmanyreasonswhynottouseRails:
ItdoesntscaleWedonthavetheskills
ItstoonicheItsamovingtargetItsinsecure
7/28/2019 Ruby on Rails Garrick
12/32
LetstryPHPonTRAX
WestartedlearningPHPonTRAX,trieditoutbeforededicangourselves
BadideaSmallcommunityLiledocumentaonHardtofindanswersaboutconvenonResortedtousingRailsdocstounderstandconvenonsTRAXwasbuiltonTakingtoolongremember:only8months
7/28/2019 Ruby on Rails Garrick
13/32
WhyRails?
Gooddocumentaon Acve,thrivingcommunity Excellentdesign
MVC,ORM,RESTful,formbuilder,validaon Solidphilosophy
DRY,CoC,automatedtesng
7/28/2019 Ruby on Rails Garrick
14/32
MVC=ModelViewController
Changesinonecomponentdont
affectothercomponents
Reusemodelsthroughoutyour
applicaon
View
Model
Controller
IncomingRequest
7/28/2019 Ruby on Rails Garrick
15/32
ORM=ObjectRelaonalMapping
school = School.find_by_name('Computer Science')
print school.departments.count()
school.name = 'Information & Computer Science'
school.save()
Enableseasydatabaseaccess&manipulaon:
7/28/2019 Ruby on Rails Garrick
16/32
REST=RepresentaonalStateTransfer
CleanURLs:hp://app.uci.edu/biosci/professor/applicaon/123
URLsrepresentresources,(department,applicaon,user,etc)
HTTPGET,PUT,POST,DELETErepresentoperaonsonresources
Canbestateless,challengingforflows/wizards UsefulincombinaonwithAJAX(script.aculo.us)
7/28/2019 Ruby on Rails Garrick
17/32
CoC&DRY
CoC=ConvenonoverConfiguraon DRY=DontRepeatYourselfIfyournamingschemefollowstheRailsconvenon,youcanquickly
startusingdatabasebackedobjects
GivenaDBtablenameusers:
class User < ActiveRecord::Base
end
Railsmakesiteasytolovetheconvenon;itwillsaveyoualotof
code(=fewermistakes)
7/28/2019 Ruby on Rails Garrick
18/32
FormBuilder
true, :help => "date
the something happened" %>
true, :help => "the
reference number for this thing" %> true, :label =>
"options", :help => "select something from the list" %>
u.id, :label =>
u.description }}, :label => "including these?", :help => "tick
the whatever boxes are appropriate for thisthing" %> "what was Willis talkin'
about?" %>
"mailing list", :help =>
"can we send you a bunch of spam?" %>
7/28/2019 Ruby on Rails Garrick
19/32
FormBuilder
7/28/2019 Ruby on Rails Garrick
20/32
Validaon
CREATE TABLE applicants (
id int(11) unsigned auto_increment
primary key,
username varchar(64) not null,password varchar(64) not null,
created_at timestamp not null,
email varchar(255) not null,
) ENGINE=InnoDB;
class Applicant < ActiveRecord::Basevalidates_presence_of :username, :email
validates_uniqueness_of :username
validates_as_email :email
end
7/28/2019 Ruby on Rails Garrick
21/32
AutomatedTesng
rSpec:hp://rspec.info/examples.html unit/regressiontesng(model) Integraontesng(controller/views) Selenium,webRAT(fullstack)AutomatedtesngisanunderlyingphilosophyofRails
7/28/2019 Ruby on Rails Garrick
22/32
Challenges
Railsisnotwithoutitschallenges
7/28/2019 Ruby on Rails Garrick
23/32
Challenge:RailsVelocity
Railsisrapidlyevolving Thisvelocityofchangeissustainablethroughextensiveautomatedtests
UpgradingRailswillbreakexisngapplicaonsLessofaproblemwithqualityunit&integraontests
UpsidetoRailsupgrades:yourapplicaonsgetusefulnewfeaturesLikebuiltincrosssiterequestforgeryprotecon
7/28/2019 Ruby on Rails Garrick
24/32
Challenge:LegacySchema
Integrangwithlegacydatacanbeachallenge LegacydatabaseschemaprobablydoesntfitRailsconvenon
Withsomeextracode,yourappscanintegratewithexisngdata
Examples:Exisngdatabasetablenamescampus_id:BIGINT(12)UNSIGNEDZEROFILL
7/28/2019 Ruby on Rails Garrick
25/32
Challenge:LegacySchema
WecacheUCI'sdirectoryofusersforfast
lookup:
Railsconvenon:nametablesusingpluralform
e.g.:'users'insteadof'directory Railsconvenon:nameprimarykeys'id'
7/28/2019 Ruby on Rails Garrick
26/32
Challenge:LegacySchema
Soluontodefyingconvenon:
class User < ActiveRecord::Base
self.table_name = "directory"
self.primary_key = "campus_id"
end
7/28/2019 Ruby on Rails Garrick
27/32
Challenge:LearningtheConvenon
TakesmetolearntheRailsconvenoninially
Onemecost,lasngproducvityenhancement
Helpfulresources:rubyonrails.orghowtosandtutorials,rubypickaxebook,rails2books,
otherpeoplescode
7/28/2019 Ruby on Rails Garrick
28/32
Challenge:Staffing
FewqualifiedRailsapplicaondevelopers Werecruitbasedonexperiencewithrelatedlanguages&frameworks
7/28/2019 Ruby on Rails Garrick
29/32
RecruitToday
Stats:10,700totalapplicants
189posions45,513applicantfiles16,408referencefiles
Infrastructure:Loadbalancer:FoundryNetworks
ServerIron
Servers:ThreeRHELboxes
Applicaonstack:Linux,Apache,
MongrelRails,MySQL
7/28/2019 Ruby on Rails Garrick
30/32
LogicalviewofRecruitArchitecture
7/28/2019 Ruby on Rails Garrick
31/32
Conclusion
Reliable,campuswideapplicaonscanbebuiltonRails
WeenjoyusingRailsbecauseofitsinnovavedesignandunderlyingphilosophy
AdopngRailssolvesproblemsandcreatessomenewchallenges
WouldwedevelopinRailsagain?Yes!
7/28/2019 Ruby on Rails Garrick
32/32
Quesons?
MaxGarrickmgarrick@uci.edu/9498247917UCIrvineNetwork&AcademicCompungServices
Recommended