-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1169 lines (1115 loc) · 73.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<title>Dev Bootcamp Site | Trevor Nelson</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/stylesheet.css"/>
<link href='http://fonts.googleapis.com/css?family=Oswald|Arvo|Roboto+Slab:300,700,100' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top" id="main-navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav-collapse1">
<span class="fa fa-bars"></span>
</a>
</div>
<div class="collapse navbar-collapse" id="nav-collapse1">
<ul class="nav navbar-nav">
<li><a href="#about">Home</a></li>
<li><a href="#projects" id="nav-projects">Projects</a></li>
<li><a href="#blog_archive" id="nav-blog">Blog</a></li>
<li><a href="#resume" id="nav-resume">Resume</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<div class="dropdown">
<a class="navbar-dropdown" data-toggle="dropdown" href="#" id="nav-contact">Contact</a>
<ul class="dropdown-menu" id="social">
<li><a href="https://github.com/trevornelson" target="_blank"><span class="fa fa-github-square"></span> GitHub</a></li>
<li><a href="mailto:trevor.nelson1@gmail.com"><span class="fa fa-envelope"></span> Email</a></li>
<li><a href="https://www.linkedin.com/in/trevorandrewnelson" target="_blank"><span class="fa fa-linkedin-square"></span> LinkedIn</a></li>
<li><a href="https://twitter.com/trevor_a_nelson" target="_blank"><span class="fa fa-twitter-square"></span> Twitter</a></li>
<li><a href="http://stackoverflow.com/users/4512629/trevor-nelson" target="_blank"><span class="fa fa-stack-overflow"></span> StackOverflow</a></li>
</ul>
</div>
</li>
</ul>
</div>
</nav>
<div class="container-fluid" id="intro">
<div class="container">
<h1 id="headline">Hi, my name is Trevor.</h1>
<h2 id="sub-headline">I want to build cool things.</h2>
<div class="row" id="callouts">
<div class="col-md-4">
<span class="fa fa-building"></span>
<h3>Living in NYC</h3>
<p class="callout-text">Born in upstate New York, raised in Texas, schooled in Oklahoma. I've managed to keep "y'all" out of my lexicon, though sometimes a "big'ole" slips in here and there.</p>
</div>
<div class="col-md-4">
<span class="fa fa-line-chart"></span>
<h3>Worked in marketing</h3>
<p class="callout-text">As a manager at an Inc. 500 marketing agency for the past two years, I've sold products for small startups and national brands alike. I don't want to just sell great products anymore, though. I want to help build them.</p>
</div>
<div class="col-md-4">
<span class="fa fa-code"></span>
<h3>Love to code</h3>
<p class="callout-text">After tinkering with Python for the past few years, I decided that programming needed to graduate from hobby to a fulltime focus and attended Dev Bootcamp, a 19-week software development program. I mainly code (and dream- seriously) in Ruby and Javascript, but am learning Java and starting to dip my toes back into Python.</p>
</div>
</div>
</div>
</div>
<div class="container-fluid" id="projects">
<div class="container">
<h2>projects.</h2>
<!-- Velox Travel App -->
<div class="row">
<div class="col-md-4">
<a href="https://veloxapp.herokuapp.com/" target="_blank" class="thumbnail">
<img src="img/velox.png"/>
</a>
</div>
<div class="col-md-6">
<span class="project-title">Velox</span>
<p class="project-stack">AngularJS, Ruby on Rails, PostgreSQL, Heroku, Google QPX API, Zilyo API</p>
<p>Flight and hotel planning app built using an Angular frontend backed by a Rails API. With no previous Angular experience, my team and I learned Angular and finished this app in 7 days as our Dev Bootcamp final project.</p>
</div>
<div class="col-md-2">
<p class="project-date">April, 2015</p>
<p>
<a href="https://veloxapp.herokuapp.com/" target="_blank" class="btn btn-default project-link"><span class="fa fa-external-link"></span> link ></a>
</p>
<p>
<a href="https://github.com/trevornelson/Velox" target="_blank" class="btn btn-default project-link"><span class="fa fa-code-fork"></span> source ></a>
</p>
</div>
</div>
<!-- StackOverflow Clone -->
<div class="row">
<div class="col-md-4">
<a href="http://lamboverrice.herokuapp.com/" target="_blank" class="thumbnail">
<img src="img/lamboverrice.png"/>
</a>
</div>
<div class="col-md-6">
<span class="project-title">Lamb OverRice</span>
<p class="project-stack">Ruby on Rails, JQuery, PostgreSQL, Heroku, Rspec, Capybara</p>
<p>A Ruby on Rails StackOverflow clone with a name inspired by the delicious halal food cart in front of Dev Bootcamp. Highlights include polymorphic associations, sorting by trending questions and ajax-driven duplicate vote validations.</p>
</div>
<div class="col-md-2">
<p class="project-date">March, 2015</p>
<p>
<a href="http://lamboverrice.herokuapp.com/" target="_blank" class="btn btn-default project-link"><span class="fa fa-external-link"></span> link ></a>
</p>
<p>
<a href="https://github.com/trevornelson/LambOverice" target="_blank" class="btn btn-default project-link"><span class="fa fa-code-fork"></span> source ></a>
</p>
</div>
</div>
<!-- Java Dashboard -->
<div class="row">
<div class="col-md-4">
<a href="http://java-analytics-dashboard.com" target="_blank" class="thumbnail">
<img src="img/java-dashboard.png"/>
</a>
</div>
<div class="col-md-6">
<span class="project-title">Analytics Dashboard v2.0</span>
<p class="project-stack">Java, Backbone.js, D3.js, underscore.js, Google Cloud Endpoints, Google Cloud Datastore, Google Analytics API, Maven</p>
<p>Rebuilt my first application, an analytics reporting dashboard, in Java and Backbone.js as a means of learning both. This app allows users to log in to their Google account and create analytics dashboards for the Google Analytics accounts they have access to.</p>
</div>
<div class="col-md-2">
<p class="project-date">In Progress</p>
<p>
<a href="http://java-analytics-dashboard.com" target="_blank" class="btn btn-default project-link"><span class="fa fa-external-link"></span> link ></a>
</p>
<p>
<a href="https://github.com/trevornelson/java-analytics-dashboard" target="_blank" class="btn btn-default project-link"><span class="fa fa-code-fork"></span> source ></a>
</p>
</div>
</div>
<!-- Visual Basic Reporting Dashboard -->
<div class="row">
<div class="col-md-4">
<a href="https://github.com/trevornelson/google-analytics-reporting-dashboard" class="thumbnail">
<img src="img/reporting-dashboard.png"/>
</a>
</div>
<div class="col-md-6">
<span class="project-title">Analytics Dashboard v1.0</span>
<p class="project-stack">Visual Basic, Microsoft Access, Google Analytics API, OAuth 2.0</p>
<p>Developed a monthly reporting dashboard while at Acceleration Partners. The dashboard was built off of Microsoft Access and used Visual Basic to query the Google Analytics API to build client-facing monthly reports.</p>
</div>
<div class="col-md-2">
<p class="project-date">April, 2014</p>
<!-- <p>
<a href="" target="_blank" class="btn btn-default project-link"><span class="fa fa-external-link"></span> link ></a>
</p> -->
<p>
<a href="https://github.com/trevornelson/google-analytics-reporting-dashboard" class="btn btn-default project-link"><span class="fa fa-code-fork"></span> source ></a>
</p>
</div>
</div>
<!-- Sparki -->
<div class="row">
<div class="col-md-4">
<a href="#" class="thumbnail">
<img src="img/sparki.png"/>
</a>
</div>
<div class="col-md-6">
<span class="project-title">Twitter-Controlled Robot Pet</span>
<p class="project-stack">Raspberry Pi, Arduino, Ruby, C, Twitter API</p>
<p>Built off of a Sparki mobile robot, the goal of this project is for a Raspberry Pi to monitor Twitter for tweets that contain certain hashtags and send Sparki's Arduino board movement commands via bluetooth. Basically I'm building myself a pet with the internet as its brain. Programming is fun.</p>
</div>
<div class="col-md-2">
<p class="project-date">In Progress</p>
<!-- <p>
<a href="" target="_blank" class="btn btn-default project-link"><span class="fa fa-external-link"></span> link ></a>
</p>
<p>
<a href="https://github.com/trevornelson/java-analytics-dashboard" target="_blank" class="btn btn-default project-link"><span class="fa fa-code-fork"></span> source ></a>
</p> -->
</div>
</div>
<!-- Squeek Lights -->
<div class="row">
<div class="col-md-4">
<a href="http://www.squeeklights.com" target="_blank" class="thumbnail">
<img src="img/squeek-lights.png"/>
</a>
</div>
<div class="col-md-6">
<span class="project-title">Squeek Lights Site</span>
<p class="project-stack">Python, Django, Google App Engine, Google Cloud Datastore, Instagram API, Bootstrap</p>
<p>Site created for a friend's concert lighting rental company. The current site uses Bootstrap, Google App Engine and a Python backend. Building a site admin tool that allows my friend to enter the location and date of shows he is lighting for. Venues can be searched for via the Google Places API, where the latitude and longitude is stored along with the time of the show. The app periodically queries and stores the Instagram API for pics from shows that he lights for.</p>
</div>
<div class="col-md-2">
<p class="project-date">In Progress</p>
<p>
<a href="http://www.squeeklights.com" target="_blank" class="btn btn-default project-link"><span class="fa fa-external-link"></span> link ></a>
</p>
<p>
<a href="https://github.com/trevornelson/squeeklights" target="_blank" class="btn btn-default project-link"><span class="fa fa-code-fork"></span> source ></a>
</p>
</div>
</div>
<!-- Udacity Backend Development Wiki -->
<div class="row">
<div class="col-md-4">
<a href="http://webdevtrevwiki.appspot.com/" target="_blank" class="thumbnail">
<img src="img/wiki.png"/>
</a>
</div>
<div class="col-md-6">
<span class="project-title">Udacity Wiki</span>
<p class="project-stack">Python, Webapp2, Google App Engine, Google Datastore, Memcache, Foundation</p>
<p>Developed the backend for a Wiki as part of the Udacity Backend Web Development course's final project. The site's backend was built using Python and Google App Engine. Core functionality includes cookie based log in/log out, password hashing, and memcached database queries. Creating a new wiki page is done by requesting a new URL. If a URL exists, logged in users are able to edit page content.</p>
</div>
<div class="col-md-2">
<p class="project-date">October, 2014</p>
<p>
<a href="http://webdevtrevwiki.appspot.com/" target="_blank" class="btn btn-default project-link"><span class="fa fa-external-link"></span> link ></a>
</p>
<!-- <p>
<a href="" class="btn btn-default project-link"><span class="fa fa-code-fork"></span> source ></a>
</p> -->
</div>
</div>
<!-- Competitor Client Tracker -->
<div class="row">
<div class="col-md-4">
<a href="https://competitor-client-tracker.herokuapp.com" target="_blank" class="thumbnail">
<img src="img/competitor-client-tracker.png"/>
</a>
</div>
<div class="col-md-6">
<span class="project-title">Client Tracker</span>
<p class="project-stack">Ruby on Rails, PostgreSQL, Heroku, Nokogiri, Rspec, Bootstrap</p>
<p>A simple afternoon project built in Rails that allows users to track competitor's client portfolio pages for added and removed clients.</p>
</div>
<div class="col-md-2">
<p class="project-date">April, 2015</p>
<p>
<a href="https://competitor-client-tracker.herokuapp.com" target="_blank" class="btn btn-default project-link"><span class="fa fa-external-link"></span> link ></a>
</p>
<p>
<a href="https://github.com/trevornelson/client-competitor-tracker" target="_blank" class="btn btn-default project-link"><span class="fa fa-code-fork"></span> source ></a>
</p>
</div>
</div>
</div>
</div>
<!-- Blog Section -->
<div class="container-fluid" id="blog_archive">
<div class="container">
<h2>blog.</h2>
<div class="row">
<div class="col-md-12">
<a href="#" data-toggle="modal" data-target="#git-github-command-line">Git, Github & The Command Line</a>
<a href="#" data-toggle="modal" data-target="#css-design">CSS Design</a>
<a href="#" data-toggle="modal" data-target="#arrays-hashes-technical-death-metal">Arrays, Hashes & Technical Death Metal</a>
<a href="#" data-toggle="modal" data-target="#map-methods">Using Enumerable#map Methods</a>
<a href="#" data-toggle="modal" data-target="#flat-ui-bootstrap">Site Redesign: Flat UI & Bootstrap</a>
<a href="#" data-toggle="modal" data-target="#classes-objects-robot-guitarists">Classes, Objects and Robot Guitarists</a>
<a href="#" data-toggle="modal" data-target="#h-to-the-is-a">H to the Is-A, V to the Has-A</a>
<a href="#" data-toggle="modal" data-target="#snakes-stones-coffee">Snakes, Stones & Coffee</a>
<a href="#" data-toggle="modal" data-target="#test-driven-development">Test Driven Development</a>
</div>
</div>
</div>
</div>
<div class="container-fluid" id="resume">
<div class="container">
<h2>resume.</h2>
<a class="resume-links" href="https://www.linkedin.com/pub/trevor-nelson/27/b43/42a" target="_blank"><span class="fa fa-linkedin-square"></span> View LinkedIn</a>
<a class="resume-links" href="trevor_nelson_resume.pdf" target="_blank"><span class="fa fa-file-pdf-o"></span> Download Resume</a>
<div class="row" id="highlights">
<h3 class="resume-section-header">Highlights</h3>
<ul class="list-unstyled">
<li><span class="fa fa-pie-chart"></span>Developed Client-Facing Google Analytics API Reporting Platform</li>
<li><span class="fa fa-search-plus"></span>Increased Organic Search Traffic +64% For a National Sporting Goods Brand in 4 Months</li>
<li><span class="fa fa-facebook-square"></span>Reduced a Lingerie Ecommerce Retailer's Facebook Ads CPA -59% While Growing Revenue 30%</li>
<li><span class="fa fa-google"></span>Grew AdWords Revenue +104% While Increasing Margin +15% For a Fishing Supply Retailer</li>
</ul>
</div>
<div class="panel panel-default" id="work-history">
<div class="panel-heading"><h3 class="resume-section-header">Work History</h3></div>
<div class="row">
<div class="col-md-4">
<h3 class="job-title">Manager, Digital Strategy</h3>
<h3 class="company">Acceleration Partners</h3>
</div>
<div class="col-md-8">
<ul class="list-group">
<li class="list-group-item">Managed digital strategy retainer accounts and projects</li>
<li class="list-group-item">Created client-facing reporting dashboards using the Google Analytics API</li>
<li class="list-group-item">Consulted on information architecture, SEO and analytics</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-4">
<h3 class="job-title">SEO & PPC Consultant</h3>
<h3 class="company">Freelance</h3>
</div>
<div class="col-md-8">
<ul class="list-group">
<li class="list-group-item">Contracted with marketing and web design agencies</li>
<li class="list-group-item">Conducted technical SEO audits and PPC account audits</li>
<li class="list-group-item">Executed backlink audit and removal campaigns</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-4">
<h3 class="job-title">Product Merchandiser</h3>
<h3 class="company">HomeWetBar.com</h3>
</div>
<div class="col-md-8">
<ul class="list-group">
<li class="list-group-item">Oversaw marketing including SEO, store feeds and site content</li>
<li class="list-group-item">Prepared sales forecasts and purchased all product inventory</li>
<li class="list-group-item">Developed website optimization projects and a full site rebrand</li>
</ul>
</div>
</div>
</div>
<!--End of work history-->
<div class="panel panel-default" id="education-history">
<div class="panel-heading"><h3 class="resume-section-header">Education History</h3></div>
<div class="row">
<div class="col-md-4">
<h3 class="institution">Dev Bootcamp</h3>
<h3 class="course">Web App Development</h3>
</div>
<div class="col-md-8">
<ul class="list-group">
<li class="list-group-item">Object-oriented design principles and test-driven development practices</li>
<li class="list-group-item">Curriculum focused on fullstack Ruby on Rails and JavaScript</li>
<li class="list-group-item">Emphasis on pair programming and team-based agile development processes</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-4">
<h3 class="institution">University of Oklahoma</h3>
<h3 class="course">Entrepreneurship & New Venture Management Degree</h3>
</div>
<div class="col-md-8">
<ul class="list-group">
<li class="list-group-item">Gained experience in business plan and product development processes</li>
<li class="list-group-item">Learned start-up financial and path-to-market planning</li>
<li class="list-group-item">Advanced to the semi-finals in the Governor's Cup Business Plan Competition</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-4">
<h3 class="institution">Udacity</h3>
<h3 class="course">Backend Web Development in Python</h3>
</div>
<div class="col-md-8">
<ul class="list-group">
<li class="list-group-item">Developed server-side web app software for a blog and wiki deployed on Google App Engine</li>
<li class="list-group-item">Learned caching, user login, hashing, JSON/XML APIs and database querying</li>
<li class="list-group-item">Completed course certification</li>
</ul>
</div>
</div>
</div>
<!-- End of Education History -->
</div>
<!--End of Resume-->
</div>
<div class="container-fluid" id="footer">
</div>
<!-- Modals -->
<div class="modal fade" id="chefs-kitchen">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Chef's Kitchen</h4>
</div>
<div class="modal-body">
<p>
Dev Bootcamp always stood out to me because of the culture and approach to learning that the program seemed to be centered around. After my first week of Phase 0 at DBC, I've definitely felt great about my decision to attend. From what I've experienced so far, Dev Bootcamp is culturally very similar to what I expected. All of the other members of my cohort seem to be very smart, driven, and open to help others. Phase 0 has certainly been more structured and involved than I was expecting. I was assuming Phase 0 would be more akin to long term homework that was more self-paced, though it became quickly apparent that my learning progress would be pushed even before I started the on-site portion of Dev Bootcamp. I've realized that I need to be much more structured and intentional with Phase 0's curriculum in order to be able to keep up and make the most of this time before the on-site intensive begins. While there's definitely a part of me that's nervous about the fast-paced learning that's to come with Dev Bootcamp, I'm really excited to get started on week 2!
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="git-github-command-line">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-times"></span></button>
<h4 class="modal-title">Git, GitHub & Command Line</h4>
</div>
<div class="modal-body">
<p>
After a rushed start getting my enrollment finalized and accidentally bricking, then eventually fixing, my computer's wifi trying to dual boot Linux, my first week of Dev Bootcamp's Phase 0 is coming to a close today. So what've I learned so far? Can I program leftove.rs, Silicon Alley's hot new app (it's like airbnb but for food)? Did I write some sweet-ass code that allows anyone to download puppies from the internet for free? Sadly, there's no downloadable puppies yet- this week at DBC was devoted to learning the command line and version control. You're probably thinking "command line and version control don't sound like the sexiest of subjects". Valid point. Also, incorrect. Here's what I've found makes git and bash both totally sexy from an education standpoint.
</p>
<p>
First things first- the command line is totally awesome. At first, I had been apprehensive about ever using the command line. Pointing and clicking around folders and files was A-OK by me, and using the command line always seemed so inefficient. Dev Bootcamp forced me to actually learn it, instead of blindly copying commands from tutorials like I had been doing, and I completely love it now. While I still have a lot of work to do before I can claim to be a command line power user (or even mildly proficient), I understand why trying to program only using the operating system's GUI is downright silly. There's nothing quite like being able to zoom around your computer's directory structure, edit things and run scripts without having to touch that damned mouse. One of the major reasons I think that touch screen computing has become so popular is because of their tactile nature- you poke something; it does something. There's seemingly less of a barrier between you and the computer. Using the command line is one step further than this, where you're totally connected to and in control of all that cool stuff your computer is doing.
</p>
<p>
Version control is another topic that probably doesn't get the masses up on their feet. Although saves were a great way to keep playing videogames by "ok-i'll-get-ready-for-bed-at-the-next-save-point"-ing, saving isn't generally all that exciting. What makes version control and git any different? Version control is sexy because of how beneficial it is developing software. From playing with git this week, the obvious benefit to using version control is being able to "roll back" changes to software so that you can undo any whoopsie-poopsies in your code. Git, more specifically, seems like it would be really invaluable when joining a new software project that has already been in development by allowing you to get a rough understanding of where the project has been and where it's going. Git makes this easy by keeping a log of all the changes made to a piece of software. These changes are grouped together into commits, which allows software engineers to track changes in a meaningful, logical way. For example, if fixing a program's bug requires edits to 3 separate files, these separate changes can be grouped into the same commit and labeled in git. This allows a programmer to review and understand the meaningful changes that have been made to software. The thing that really makes version control systems sexy, though, is that they embolden developers to try new things. By making reverting changes so easy, being experimental with your programming is a lot less scary. It seems that version control is a major driver of innovation by allowing programmers to make big changes to software. Finally, version control is important because of the collaborative nature it sends itself to. Without version control, developers would constantly be overwriting eachother's work. That would probably make for a fairly tense work environment. GitHub takes git as it's foundation, and allows users to share their code online, so that others can benefit from your good ideas while also helping improve your software.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="css-design">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-times"></span></button>
<h4 class="modal-title">CSS Design</h4>
</div>
<div class="modal-body">
<p>
The week 2 curriculum for Dev Bootcamp has been focused on foundations in HTML and CSS. While I've had quite a bit of previous experience with HTML, I've really relied on hacking my way through a CSS stylesheet with past projects. After this week, I feel much more confident styling HTML with CSS, and am looking forward to applying my new CSS skills on my next project. What makes CSS so important for web development is that it allows you to "beautify" websites at scale, instead of changing the styling for each HTML element separately. Two important CSS concepts that are required for styling websites at scale are ids and classes.
</p>
<p>
Ids and classes are so important for CSS and web development, because it allows web developers to add styling to specific types of elements (classes), as well as specific HTML elements uniquely (ids). Classes and ids are both set by adding them to inside of opening HTML tags:
</p>
<p>
<pre>
<div id="id-name">
<h1 class="class-name">Some Text In HTML</h1>
</div>
</pre>
</p>
<p>
In the above example, "id-name" and "class-name" can be set to any strings of text you would like, and are used to identify classes and ids for styling to be applied to from the CSS file. This example's CSS might look like this:
</p>
<p>
<pre>
<code>
#id-name {
color: red
}
.class-name {
background-color: blue
}
</code>
</pre>
</p>
<p>
You'll notice that id selectors in CSS are preceded by a "#", while a class selector is preceded by a ".". Any CSS styles between the following brackets will be applied to an HTML element with the given class or id name.
</p>
<p>
If classes and ids both can be used to add styling to specific elements on a page, how can you decide which you should use? Here's some common guidelines to follow when planning an HTML page's classes and ids.
</p>
<p>
<ul>
<li><b>Use a class</b> for styling that will apply to multiple elements on a page. Ids should only appear on a given HTML page once, while classes can be attached to as many HTML elements as the web developer wants.</li>
<li><b>Use an id</b> to add styling to a unique element on the stage.</li>
<li><b>Use an id</b> if you want to be able to add an internal link to a specific piece of content, or if it would be valuable for your site's users to link to a specific spot on a page. This can often be really helpful for evergreen content where there is a large amount of content on a page that is split into sections.</li>
<li><b>Use an id</b> for layout items such as a page's header, navigation, main content, and footer.</li>
<li><b>Use both ids and classes</b> in the same HTML element when necessary. The class will allow a single CSS change to apply to multiple elements, while any specific styles for a given element can be set using the id.</li>
</ul>
</p>
<p>
Properly setting up an HTML document with ids and classes initially can be a huge help when applying styling to the page and help keep your CSS code efficient and readable.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="arrays-hashes-technical-death-metal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-times"></span></button>
<h4 class="modal-title">Hashes, Arrays & Technical Death Metal</h4>
</div>
<div class="modal-body">
<p>
Week 3 of Dev Bootcamp Phase 0 was a crash course in the foundations of ruby. Exercises for the week covered variables, condition statements and methods, as well data structures. Data structures are an incredibly important element of programming that allow computer programs to organize data for a specific process. Using data structures in a program allows for data to be accessed in a predictable, standardized way and is one of the central concepts in programming that allow for efficient, reusable code.
</p>
<p>
One of the most widely used and important data structures is called an array. The word "array" sounds a whole lot more daunting than it is- an array is basically just a list of objects that your program can access through a single variable name. The beauty with arrays is that they allow a program to run the same code on a list of objects. This is commonly called a loop, and is invaluable for writing efficient, easy to manage code. Say, for example, you wanted to write a program to print out your favorite albums from 2014. Without an array, you would need to do something like this:
</p>
<p>
<pre>
<code>
print "Ryan Adams - Ryan Adams"
print "The Flesh Prevails - Fallujah"
print "Conquering Dystopia - Conquering Dystopia"
print "Voices - Phantogram"
print "Morning Phase - Beck"
print "The Physical World - Death From Above 1979"
print "Once More 'Round The Sun - Mastodon"
print "They Want My Soul - Spoon"
print "What Is This Heart? - How To Dress Well"
print "Singles - Future Islands"
</code>
</pre>
</p>
<p>
My outstandingly impeccable musical taste aside, see how verbose that is? Now think about if you also wanted your program to print out the top 10 movies and plays. There's a lot of code for a seemingly simple end goal. Now, if all of these album titles were stored in a list, our code could look like this:
</p>
<p>
<pre>
<code>
top_albums_2014 = ["Ryan Adams - Ryan Adams",
"The Flesh Prevails - Fallujah",
"Conquering Dystopia - Conquering Dystopia",
"Voices - Phantogram",
"Morning Phase - Beck",
"The Physical World - Death From Above 1979",
"Once More 'Round The Sun - Mastodon",
"They Want My Soul - Spoon",
"What Is This Heart? - How To Dress Well",
"Singles - Future Islands"]
top_albums_2014.each do |album|
print album
end
</code>
</pre>
</p>
<p>
Quite a bit cleaner, right? But what if we want to be able to add more info about each album, like the release date, genre and and a link to the band's website? While you could do this in arrays, it would be kind of messy. Arrays are really good for listing out the same kind of information, but aren't really effective when it comes to combining different types of data, because there isn't a meaningful way to access objects in an array besides their sequential order. This is where hashes, sometimes referred to as dictionaries in other programming languages, come in handy. Hashes allow for data to be labeled using a structure of key: value. Here's what a hash might look like for one of the albums in my top albums of 2014 list:
</p>
<p>
<pre>
<code>
the_flesh_prevails = {'album'=>'The Flesh Prevails',
'artist'=>'Fallujah',
'genre'=>'Technical Death Metal',
'website'=>'http://fallujah.bandcamp.com/'}
</code>
</pre>
</p>
<p>
Now for the cool part- you can combine a list of these hashes into an array and loop through this array of hashes, accessing specific pieces of data as you go. Nerd-rad! Here's an array of variables that link to a hash like the one above, and the code needed to print this data:
</p>
<p>
<pre>
<code>
top_albums_2014 = [ryan_adams, the_flesh_prevails, conquering_dystopia, voices, morning_phase, the_physical_world, once_more_round_the_sun, they_want_my_soul, what_is_this_heart, singles]
print "Trevor's Top Albums of 2014"
top_albums_2014.each do |album|
print "Album Title: " + album['album']
print "Artist: " + album['artist']
print "Genre: " + album['genre']
print "Website: " + album['website']
end
</code>
</pre>
</p>
<p>
Pretty cool, amirite? Using data structures like this ends up being kind of similar to how websites generate dynamic content, such as Facebook displaying your newsfeed. The newsfeed could contain a list of your friends posts (arrays), with each user's name, profile picture, status update ect... contained in a hash for that newsfeed post.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="learning-how-to-learn">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-times"></span></button>
<h4 class="modal-title">Dev Bootcamp & Learning How To Learn</h4>
</div>
<div class="modal-body">
<p>
Besides learning web app development at Dev Bootcamp, one of the other focuses of the curriculum is for students to understand how they learn best, and to develop this as a skill. As part of this component of Dev Bootcamp, we learned about Gregorc thinking styles, a theory developed by Anthony Gregorc which seeks to classify people into one of 4 thinking styles. After taking a Gregorc thinking styles quiz, I found that I am primarily an "abstract sequential" thinker. This thinking style is biased towards enjoying when their point is heard in a learning environment, as well as enjoying analyzing situations thoroughly before making a decision. Because I'm an abstract sequential thinker, I also learn best when I have access to experts and am learning in stimulating environments.
</p>
<p>
My experience so far in Phase 0 at Dev Bootcamp has strongly aligned with what I've learned about my thinking style. I've learned a lot during each of my guided pairing sessions and have really enjoyed them, most likely because I had access to an expert during the sessions. I was able to dive deeper into the material and ask more theoretical questions, learning more about the "why" instead of just the "how" for specific learning concepts. I plan to take full advantage of this by asking questions more during my guided pairing sessions that will help me understand concepts at a deeper, more abstract level.
</p>
<p>
My learning style has also become apparent during Phase 0 in my struggle with managing my time. Because I really enjoy learning in a very detailed manner, I have often devoted too much time to challenges that I already understood sufficiently. I'm also very used to less structured learning with less specific rules, due to learning to program on my own for the past year. Learning through structured curriculum is important for me, because it is forcing me to learn in new ways and learn concepts I'm not completely interested in initially. Due to being too detailed in my learning habits often, I've been attempting to time box myself using the pomodoro technique. I've struggled with respecting my initial time boxing, though I've progressively become better at this. Outside of this, I think that the biggest opportunity to grow my personal learning competencies is to try developing my learning style more towards the abstract random learning style, specifically the focus on relationships in learning.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="drowning-in-a-sea-of-data">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-times"></span></button>
<h4 class="modal-title">Drowning In A Sea Of Data</h4>
</div>
<div class="modal-body">
<p>
In the past decade, the tech industry has amassed an astronomical amount of data, and it doesn't show any signs of slowing down. Tech giants like Apple and Google are building more and more shopping mall size data warehouses every year to accommodate the tidal wave of data being collected. A large majority of your actions, whether it's shopping online or taking the train to Brooklyn, is leaving behind a trail of data. While this data has already made a meaningful positive impact in everyday life, there's a tremendous amount of opportunity still hiding in data right in front of the tech industry's nose.
</p>
<p>
The problem with this massive amount of data the tech industry is sitting on is that it still doesn't know (or simply doesn't) analyze a large amount of it. What's more, the sheer volume of data can make it difficult to strip away the noise to find meaningful data. Picture an old chapel with multiple choirs, each singing a different hymn. Each choir performs beautifully in their own right, but their voices echoing against one another produces a chaotic hum that is undecipherable. There may be a brief moment where you can hear one song with clarity as the other songs are at rest, or the choirs may briefly unite in a musical chord for a note, only to go back to the chaotic hum. This is similar to where big data is today. Insights can be gained from isolated data like the moments when a single choir was singing. This misses a lot of the most significant insights that can be found from looking at data more broadly. Techniques like predictive modeling allow for the voices of the choirs to to be aligned briefly to make a chord, but a majority of the song will still be that chaotic hum.
</p>
<p>
This big data problem has been caused by the tech industry approaching data with a “data first, meaning later” mentality. If data is not meaningful, all it does is dilute any data practices. While advanced data analytics techniques are making it easier to cut through the noise, more attention needs to be placed on data collection by ensuring data has value.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="map-methods">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-times"></span></button>
<h4 class="modal-title">Using The Enumerable#map Method</h4>
</div>
<div class="modal-body">
<p>
One of the most useful Ruby methods I've learned about so far at Dev Boorcamp is the #map method of the enumerable class. This method iterates through an array or hash, running a code block on each element and returning an array or hash of the altered values. A quick demonstration to drive things home is always nice:
</p>
<p>
<pre>
<code>
> [1,2,3,4,5,6,7,8].map {|x| x + 100}
=> [101, 102, 103, 104, 105, 106, 107, 108]
</code>
</pre>
</p>
<p>
Running the above code in IRB will iterate through each of the array elements and add 100 to each of them. The |x| portion of the line of code is setting x as the code block's variable which, in this case, corresponds to the current element in an array as it's being iterated over. Arrays are pretty easy-peasy with the map method, but-
</p>
<img src="img/hashes-how-do-they-work.jpg"/>
<p>
Using the #map method on a hash is pretty similar to an array, spare 3 key (no pun intended) differences:
</p>
<p>
1. The map's code block variable needs a buddy. Each iteration of an array just contained a single object, but each iteration of a hash has 2- one for the key and one for the value. This means the map method code block needs a variable for each. Ruby developers commonly use |k, v|, where "k" is the key and "v" is the value.
</p>
<p>
2. The code after the block variables needs to be in those cute little curly brackets or else your code will throw errors.
</p>
<p>
… and I can't remember what #3 was. Oh well, moving forward. Once again, a demonstration is worth a thousand words. Unless the demonstration is already a thousand words, then it's worth like a billion or something.
</p>
<p>
<pre>
<code>
> hash = {"one"=>1, "two"=>2, "three"=>3, "four"=>4, "five"=>5, "six"=>6}
> hash.map{ |k, v| { k => v + 100 } }
=> [{"one"=>101}, {"two"=>102}, {"three"=>103}, {"four"=>104}, {"five"=>105}, {"six"=>106}]
</code>
</pre>
</p>
<p>
Hold the phone. The output looks like it's actually an array? Ah, that's right- that's what key difference #3 was.
</p>
<p>
3. Using #map on a hash will output an array version of the hash.
</p>
<p>
While you can hack this array of key/value pairs to be usable, it definitely isn't ideal because it won't behave like a normal hash. I found a really handy-dandy solution to this that requires you to extend the standard Hash class in Ruby. No worries, it's not as scary as it sounds.
</p>
<p>
<pre>
<code>
class Hash
def hmap(&block)
Hash[self.map {|k,v|| block.call(k,v) }]
end
end
</code>
</pre>
</p>
<p>
This new method looks like this in practice-
</p>
<p>
<pre>
<code>
> hash.hmap{ |k,v| [ k => v + 100 ] }
=> {"one"=>101, "two"=>102, "three"=>103, "four"=>104, "five"=>105, "six"=>106}
</code>
</pre>
</p>
<p>
That's hot biscuits, right? Special thanks to <a href="http://chrisholtz.com/blog/lets-make-a-ruby-hash-map-method-that-returns-a-hash-instead-of-an-array/">Chris Holtz</a> for the great #hmap method.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="pairing-feedback">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-times"></span></button>
<h4 class="modal-title">Pairing & Feedback</h4>
</div>
<div class="modal-body">
<p>
One of the most important aspects of Dev Bootcamp is its focus on peer programming. As I've solely coded alone up until this point, the thought of pair programming had me somewhat anxious initially. The most significant struggle I continue to have with pairing is feeling pressure to respond immediately instead of being able to take a moment to think through the problem at hand. I can have much more developed ideas and solutions when I have some time to think on my own.
</p>
<p>
Into the second half of Phase 0, while I feel like I can still improve greatly in my pair programming skills, I definitely see the value in pairing. Programming with a pair has helped me catch mistakes or save me from going down a rabbit hole for a challenge through my pair suggesting a new route. Pairing has also helped me think through my code more thoroughly and solidify what I'm learning by requiring me to talk about different techniques I'm employing.
</p>
<p>
The feedback component to pairing has been tremendously helpful in helping me develop both my programming and pairing skills. I think that the most impactful aspect of pairing feedback is having a log of ways that I can improve. Every week, I re-read the feedback I've received in order to focus my work in the next week on developing these areas. As programming feedback is concerned, one of the more common piece of feedback is that I can be better with sublime and command line shortcuts. In order to develop this, I've been practicing with ShortcutFoo. I also have had issues occasionally in pairing sessions communicating my ideas and explaining my thought process. As the curriculum has gotten into more complex Ruby concepts, I have definitely felt that explaining my thought process has become more challenging. Writing feedback has generally been fairly natural, though sometimes it has been difficult to find actional feedback to give. In order to develop this and give better feedback, I have been making a conscious effort to keep feedback in mind throughout the pairing session, instead of just thinking about it after the pairing session is over.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="classes-objects-robot-guitarists">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-times"></span></button>
<h4 class="modal-title">Classes, Objects and Robot Guitarists</h4>
</div>
<div class="modal-body">
<p>
This week in Dev Bootcamp, we focused exclusively on Ruby classes. Classes can be thought of as a blueprint for computing objects that a program creates. Objects created from the same class follow a shared "blueprint", which allows for software to interact and manipulate these objects in a standardized way.
</p>
<p>
Say, for example, you were shopping for a new guitar in a music store. It's fairly intuitive to tell the difference between a guitar and a drum set when shopping through the store, but computers need a bit more help when it comes to differentiating between the two. Here's how you would "teach" the computer what a guitar is using Ruby:
</p>
<p>
<pre>
<code>
class ElectricGuitar
def initialize(brand)
@stringed_instrument = true
@strings = 6
@brand = brand
@pickup = true
end
end
</code>
</pre>
</p>
<p>
The initialize method is a special method for classes that tells the computer about various attributes of the object. Each attribute is assigned just like a standard variable would in Ruby, except that the variable name starts with an "@" symbol. The ElectricGuitar class above is "telling" the computer that electric guitars are stringed instruments with six strings and a pickup. It also allows for the guitar brand to be set for new objects of the ElectricGuitar class by passing in the guitar's brand and setting it to @brand. Lets see what creating a new ElectricGuitar object looks like:
</p>
<p>
<pre>
<code>
guitar = ElectricGuitar.new("Gibson")
</code>
</pre>
</p>
<p>
This creates a new instance of ElectricGuitar and sets it to the variable name "guitar". Now, anytime Ruby sees the "guitar" object, it knows that it's a stringed instrument with a pickup and 6 strings that was made by Gibson. Now, if your computer were walking through the music store shopping for a new guitar, it would be able to identify products in the store as electric guitars.
</p>
<p>
You can't really shop for guitars without trying them out, but it would be pretty inefficient if you had to re-learn how to play a guitar with each guitar you tested out at the music store. Since your computer now knows what an electric guitar is, it can easily perform the same actions on any of the electric guitars at the store. This is done by setting instance methods when defining a class, which looks like this:
</p>
<p>
<pre>
<code>
class ElectricGuitar
def initialize(brand)
@stringed_instrument = true
@strings = 6
@brand = brand
@pickup = true
end
def play_ironman
<block of code>
end
def play_free_bird
<block of code>
end
def shred
<block of code>
end
end
</code>
</pre>
</p>
<p>
This means that any instance of ElectricGuitar would be able to use the play_ironman, play_free_bird and shred methods. Here's how that would look using the "guitar" object from earlier:
</p>
<p>
<pre>
<code>
guitar.play_ironman
guitar.play_free_bird
guitar.shred
</code>
</pre>
</p>
<p>
That's all well and good, but what if your computer happens to be a metal-head and is shopping for a sweet-ass 7 string guitar? The computer currently thinks that to be an electric guitar, it needs to have the standard 6 strings. You can fix that by creating a sub-class of ElectricGuitar:
</p>
<p>
<pre>
<code>
class SevenStringGuitar < ElectricGuitar
attr_reader :strings
attr_reader :brand
def initialize(brand)
@strings = 7
end
end
blackjackatx = SevenStringGuitar.new("Schecter")
blackjackatx.strings
=> 7
blackjackatx.brand
=> Schecter
blackjackatx.shred
=> play some rad solo
</code>
</pre>
</p>
<p>
Adding the "< ElectricGuitar" lets Ruby know that objects from the SevenStringGuitar class are just like ElectricGuitar objects- they're stringed instruments with a pickup. Though, the SevenStringGuitar class overwrites the @string variable to 7. Now, as your computer is shopping for a new guitar it will be able to know that 7 string guitars are just like electric guitars, they just have an extra string.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="h-to-the-is-a">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-times"></span></button>
<h4 class="modal-title">H to the Is-A, V to the Has-A</h4>
</div>
<div class="modal-body">
<p>
One of the core tenets of efficient and easy-to-manage software is the DRY, or "don't repeat yourself", principle. Reusing code where possible makes debugging and updating code much easier than the alternative. Two of the main ways to keep your code nice and DRY is through class inheritance and composition.
</p>
<p>
Inheritance is the concept of creating a parent-child relationship between two classes. The child class inherits the methods and variables from the parent class, which helps software avoid repeating itself. Here's an example:
</p>
<p>
<pre>
<code>
class Musician
def initialize(name)
@name = name
end
def play_music(music)
play(music)
end
end
class RapMusician < Musician
def initialize
@genre = rap
end
def rap(lyrics, beat)
play_music(beat)
print lyrics
end
end
jova = RapMusician.new("Jay-Z")
</code>
</pre>
</p>
<p>
The RapMusician class is a subclass of musician and is said to have an is-a relationship to the Musician class. You can think of this in that a rapper is-a musician. The RapMusician class inherits the @name assignment and the play_music method from the Musician class. The issue with inheritance in some instances is that as software is developed and classes are built upon, the child class can become increasingly different than the parent class until they are only loosely similar.
</p>
<p>
Composition, on the other hand, creates what is called a "has-a" relationship between objects. In practice, this essentially just looks like an object being instantiated inside of another class. An example of this kind of relationship would be a Person object that has-a Car object.
</p>
<p>
<pre>
<code>
class Person
def initialize(name, car_model)
@name = name
@car = Car.new(car_model)
end
end
class Car
def initialize(make)
@make = make
end
end
</code>
</pre>
</p>
<p>
The key to differentiating whether to use composition or inheritance to keep your code DRY is thinking about the nature of the relationship between the objects.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="snakes-stones-coffee">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-times"></span></button>
<h4 class="modal-title">Snakes, Stones & Coffee: Comparing Python, Ruby and JavaScript</h4>
</div>
<div class="modal-body">
<p>
This week in Dev Bootcamp, we switched gears from Ruby to JavaScript in our challenges. I had hacked my way through some JavaScript before, but had always felt somewhat intimidated by it for some reason. I think that coming from Python, JavaScript syntax felt a lot messier and more difficult to understand at the time, though learning Ruby before diving into JavaScript this time around felt much more natural. Just the little bit of extra training that Ruby provided with things like remembering to close off blocks of code made it much easier to come from Ruby to JavaScript, compared to from Python.
</p>
<p>
After a week of focusing solely on JavaScript, one of the most significant differences between it and Ruby is how the languages create new objects. Ruby is a lot like Python, in that it relies on using classes as a kind of blueprint for making new objects. Here's an example of how you'd create an object in Ruby:
</p>
<p>
<pre>
<code>
class Car
def initialize(make, model, year, color)
@make = make
@model = model
@year = year
@color = color
@speed = 0
end
def changeSpeed(mph)
@speed = mph
end
end
car = Car.new("Ford", "Mustang", 1969, "red")
</code>
</pre>
</p>
<p>
And now, here's how you'd create the same object in JavaScript:
</p>
<p>
<pre>
<code>
var car = {
make: "Ford",
model: "Mustang",
year: 1969,
color: "red",
speed: 0,
changeSpeed: Function(mph) {
this.speed = mph;
}
}
</code>