Baruco 2014 notes (raw)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Workshop | |
- try ember when writing a single page app, angular has a shitty router | |
- lineman.js | |
Friday: | |
1. Monorail problem | |
- propono gem - Pub-Sub architecture | |
2. Matz | |
- MRI is not a proper term, CRuby = the Ruby | |
- ruby syntax is complex, hard to make other implementaions | |
- JRuby, Rubinius (C++), RubyMotion, IronRuby (.NET), Maglev (Gemstone), Opal | |
- CRuby is not good for embedded system, no embedded API, too much POSIX (most emb system are not posix aware) | |
- Rubinius is not good, consumes too much memory | |
- mruby - C, embeddable, flexible, modular (compile-time optiotns), various platform, api-wise: 1.9 compatible) | |
- mgem - mrb gems - statically linked | |
-ve api is simple, something between Ruby and Lua | |
- vending machines run on mruby? | |
- can satellite runs mruby | |
- arduino / home automation / robots | |
- web servers | |
- mruby will not probalbt replace CRuby, it has less func and is not 2.0 compatible | |
- github.com/mruby/mruby | |
3. Piotr Szotkowski | |
- signore gem | |
- never return nils | |
- LevenShtein distance | |
- module_function - classes mixing your module will mix methods as private | |
- drb/drb - exposes object on port for outside access from the network | |
- stdlib prime? why so slow ?? | |
- play with enumerable | |
- use stdlib (weakRef!), contrbute to docs | |
- levensthtein gem | |
- end of line | |
3. Arel stuff - Pat Shaughnessy (ruby under microscope) | |
- Abstract syntax tree is built by Arel | |
- Active record call arel by using visitor pattern | |
- Visitor is a piece of code that visits the tree (visitor is dependend customized for the database mysql or sqlite etc) | |
- postgres uses yak, the same parser as ruby | |
- arel converts object to sql string, sojust postregs can revert this, the only difference is the data structures beneath | |
- index is a separete copy of data table that is sorted, each holding a reference to original | |
- use explain with sql statement to see what it does, and debug when it is slowly | |
- binary search thanks to indexes, instead of sequential search | |
- btree algorithm (divides the big table into 2) - created a tree structere (balanced tree) | |
- learn stuff down there, know internal at least to some level - it will make you a better engineer | |
4. Emily Stolfo - Release Responsibly (backwards compatiblity) - mongodb | |
- 3 ways to make code backward compatible | |
1. Simple API | |
- Simple Api: think of an api as a user interface | |
- trade off between configurabiltiy and stability | |
- Modularize (hide glory details) | |
- Have a Compatibility module | |
- Use Polymorphism instead og conditionals | |
- Backport only when necessary | |
2. Clear Communication | |
- define scope of what you support | |
- Test everything you say you support | |
- Changelog is important | |
- keepchangelog.com | |
- User trust should be a priority - maintain trust with users, cause rebuilding trust is difficult | |
- Have a deprcation strategy | |
- buffer time, use strict | |
- anticipate deprecations when designing | |
3. Semantic Versioning | |
- follow SemVer (it's lot of work) | |
- semver is a double edged sword | |
- it's a culture and community thing | |
5. JOSÉ TOMÁS ALBORNOZ | |
- conference drive development | |
- irresponsible ruby | |
6. Ruby Buddha | |
- we all were uniform | |
- you cant adopt the culture witout understaning it, the same goes for agile methodology / philoshopy | |
- the thought cant be replaced by process | |
- The perfect high, shel silverstein | |
7. RYAN LEVICK - https://speakerdeck.com/rylev/a-dangerous-game-safety-in-ruby | |
- no one is perfect not even ruby (slow, no type safety) | |
- type inference | |
- undefined method for nil - errors like this don't need to exist | |
- Option type | |
- Math is the best testing library | |
- "for all inputs a valid output is given" - referential transparency. | |
- the compiler is far less likely to be buggy than your tests | |
- Idris | |
- value rigidity | |
8. Lightig talks | |
- xml parser : https://github.com/YorickPeterse/oga | |
- sketching: @malweene | |
- shoes4 - ruby gui toolkit, cross platform: @PragTob | |
- code week. eu | |
- evil tom stuart: burn literals, default_proc method, | |
- burrows-wheeler transform - awesome - https://speakerdeck.com/tomstuart/my-favourite-algorithm | |
- @philnash | |
- nomadic programmer: @arnvald - prevent burn out instead of getting out, fight your fears, you can work anywhere :) | |
- | |
9. Day 2 - BRIAN SHIRAI- @brixen | |
- peanut butter + jelly sandwich guy - analogy of ? | |
- agile 73 / waterfal 67 success rate | |
- we dont learn from failure - doctors story | |
- step back from your ego and listen to the feedback | |
- programming is a behavioral science (not maths) | |
- perception - basketball study | |
- cognition - cards excercise - 90 % got it wrong | |
- proposition as types - logic as types, we can't really use logic as types, logic is tricky | |
- correct by construction - not a silver bullet | |
- we can't use types well - lets not rely on them | |
- 8 fallacies of programming: | |
- Same scale - if I do 1, can I do n successfully? | |
- klocs - reffering to number of lines, 2000 lines a mental limit, when you have to start getting abstractions out | |
- Same risk - if you're lanuching rockets I hope you don't use ruby? But for web form - what's the risk it fails | |
- Same cost | |
- Same granularity: eveyrthing is an object, evertyhing the same is difficult to work with | |
- Same abstraction: | |
- Same temporality, compile time ia not that important | |
- Same order (as opposed to disorder) - "Chaos" book, systems don't have simple orders, systems can widely diverge with | |
only sligth input change, becoming is more important than "be", we need to observe system | |
- General purpose programming language - terrible idea, fix: ? rubinius? | |
- types can do more harm than help | |
- nil - the most hated thing in ruby, option type on every single method, nil is not null, nil is an object | |
- nil turns any function to an identity function | |
- module_function, ruby has functions | |
- messages are the core of oo | |
- types can and should go into function, when we know what we need, types don't go where there is interoperability (objects) | |
- open source is not a spectator sport | |
- businesses dont care if you are happy, they dont care about java or ruby | |
- method missing on nilClass that returns self, then you dont have to worry until hitting the last step (eg template) | |
10. Writing fast ruby - erik michales-ober, @sferik - https://speakerdeck.com/sferik/writing-fast-ruby | |
- performance optimizatoin should be fun, have therapeutic effect just like refactoring (Katrina owen speech) | |
- levels of optimization (desgin, source, build, compile, runtime) | |
- design: architecture and algoihms (n+1 queries) | |
- source code = syntactic changes | |
- build = build flags | |
- compile = at compile time | |
- runtime, eg RUBY_GC_MALLOC_LIMIT, we are not doing this, there are other people doing it for us (Mat) | |
- Benchmark (ruby stdlib) | |
- benchmark/ips | |
- Proc#call vesrus yield, yield is nicer and 5 times faster | |
- Block vs Symbol#to_proc, rails invention takin in to ruby, but rails deos it old way still | |
- flat_map is faster than flatten | |
- Hash#merge vs Hash#merge!, 3 times faster, modifying object in memeory instead of allocationg it over and over again | |
- Hash#merge! vs Hash#[]=, 2 times faster | |
- Hash#fetch vs Hash#fetch with block, b ssing default is better with a block then as a second argumnet because block | |
is evaluated lazily, the block will only be called when the key is not found! cool. 2 times faster | |
- String@gsub vs String#sub, you are done, you replaced it, move on with your life! | |
- String#gsub vs String#tr, 5 times faster | |
- parralel assignment is not so good, it is not readable and slower | |
- using exception ofr control flow is bad - huge performance cost, just use #respond_to? | |
- while loop is faster than each_with_index | |
- mri should have a ahead of time compiler, just like other ruby implem. | |
- Sam Saffron | |
- full profeska | |
11. @jasonrclark - spelunking in ruby | |
- spelunking - cave wandering | |
- jasonrclark.com/debug | |
- built in debugging: puts, caller - prints a call stack, this kind of introspection is easy in ruby, not so easy | |
in other langs, ruby -d (shows erros even if rescued), $! global variable (??), Thread.abort_on_exception = true | |
- getting inside gems: gem open to see the source code, gem pristine cleans up all your changes to gems | |
- gems that help: Hometown spots where objects are created, pry: binding point to local scope on which we pry! | |
whereami reprints pry location | |
- pry-debugging, nexting, steping, continuing - helps when you misplace binding.pry | |
- pry-stack_explorer lets you go up and change the scope, roll back in time to method caller from callee | |
- ~/.pryrc | |
- tools: | |
- jruby - take snapshots of memory, show all object etc, heap analysis tool | |
- gdb - low level stuff debugging | |
- heavy stuff, dont really want to touch this | |
- rbtrace | |
- encouraging to dig deeper, the next layer below | |
12. @evanphx - Services | |
- everyone is talking about services | |
- surface area - behavior of an app, should be small but not too smallo | |
- programming is about being lazy, so you wite a program to do stuff for you | |
- services allow us to be creative within hte imposed boundaries | |
- services mitigate the problem with velociity differences between teams | |
- pitfalls of services: | |
- never share active record models between services | |
- shared model pain - everyone is afraid of touching models, because many codebases uses them | |
- whiteboard architecture - start with services that map intuitive boxes from the whiteboard, intuition reduces | |
cognitive burden | |
- if an app is never deployed, was it written? | |
- do a fire drill once a month, pretend that the site is down, and retrace what you doing, when you have services you have | |
different logs and different places, so you have to practice | |
- have one convention of how services talk to each other, set it and don't discuss it to much, it should be boring, just | |
exist in a system, and not be a topic of conversation between team members | |
- make the rpc calls obvious, it must scream that it goes over the wire, be explicit, show intention | |
- message passing gets awkward and cumbersome, but powerful | |
- dont retrun references from services, return "all" data | |
- futures aka promises - kind of a version of map/reduce | |
- Human Cognitive Mass threshold - when you get hits big thing you can not control anymore | |
- Every sifficiently complex problem domain will require an app larger than HCM | |
- be comfortable with breaking stuff to services, dont decouple just to decouple | |
13. Tom Stuart - @tomstuart | |
- handling nil: billion dollar mistake, try is overspecialized (too much respo) | |
- Optional is teoretically better but practically worse than try from active support | |
- For many results | |
- code driffted to the right | |
- what is the event machine ?? | |
- the point: Optional, Many and Eventually are MONADS | |
- understaing computation - book!!!!!! | |
- github tomstuart/monads | |
14. Matt Amonetti | |
- cool story, detailed about session and cookies, need to go deeper in this shit | |
15. Tom stuart evil version | |
- lisps and shit | |
- why are those languages so not used if they are based on 3 simple things? | |
- what can we do for ruby to take ore from them? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment