Hegwin.Me

The bitterest tears shed over graves are for words left unsaid and deeds left undone.

Takeaways from Ruby Conf China 2023 Day 2

Ruby Conf China 2023 参会笔记 Day 2

This year, AI is really a hot topic, from EverythingGPT to LLM, everyone is talking about this new technological change. At the two-day Ruby Conf China 2023, there were also three topics focusing on AI and LLM, which was very exciting.

This post records what I learned on the second day of Ruby Conf. There were two speakers talking about how to make Ruby and AI work together, both in terms of esoteric theories (e.g. Attention, which I didn't understand) and practical applications.

Things I learned from porting Active Record

by Wang Zuo

queryx - Schema-first and type-safe ORM for Golang and TypeScript (Aka. port ActiveRecord to Go and TS)

  • Schema first, by a file named schema.hcl
    • queryx db:create
    • queryx db:migrate
  • Type safe
    • data type: support different db
    • BigInt is not safe in JS
  • Things borrowed from AR
    • database.yml to support multiple environments
    • Querying methods
    • Association: belongs_to and has_many
    • Convention
    • DB Adapter
  • Disappearing Framework
    • Code generation according to DB config and required data types
    • Runtime does not depend on queryx

Develop a performance evaluation system in 3 months with Rails 7.1 and React 18.2

by Eric Guo (Tianhua)

Background:

  • Develop a performance evaluation system for a 3000-employee company
  • One programmer
  • 90 working days

Why Rails + React:

  • Rails: fastest web framework for human
  • Complex UI goes to React

How to ensure quality:

  • Focus on the data model
  • Clear code
  • More thinking; Less code (fewer bugs)

How to develop rapidly:

  • Only develop features essentially required by clients (or mentioned > 5 times by PM)
  • No split of FE/BE
  • Quick delivery & feedbacks
  • More usage of AI

Recase Ruby with Rust

Ruby

  • Simplicity (coding)
  • Creativity at one's will

Rust

  • Simplicity (system)
  • Creativity under rules
  • Compilation means correctness
  • Security

Examples of recasting Ruby with Rust

  • YJIT
    • Shopify rewrote YJIT with Rust
    • Follow LBBV
    • Less footguns
  • Yarp
    • BG: Ruby Parser by C but allow to mind with Rust
    • Maintained by the CRuby Team
  • Artichoke
    • Rewrote RubyVM
    • To verify feasibility (not in production)
    • Ruby code → Artichoke → WebAssembly
  • Write ruby gem in Rust

Toggle Everything in Ruby

by Zhou Yi (Jinshuju)

# There is no such code in Jinshuju
if customer.id = 1234567
  # Do something specific for this customer
else
  # Usual process
end

Customization in SaaS

  • Hard Code - became debt
  • Feature Toggle - maintained as an asset
  • Any object can be a user for a feature toggle, not necessarily to be “users” in business
  • Black and White list

GrowthBook

  • Toggle context
  • Rules
  • A/B test as rules

Other implementation

  • Store all toggles in a hash
  • Consistent Hashing to support rolling by percentage
  • Define feature toggle function in Redis (with Lua, since Redis 7)

Improve confidence in developing Rails apps with Solargraph and DAP

by Chen Zeyu (Illinois Electric)

Why type assistance boosts development confidence?

  • Intelligent code completion
  • Documentation Tips
  • Bug Diagnostics

Toolbox:

Data visualization based on LLM

by Jin Xiaoming (Ekohe)

Case Study: Data analytics and visualization with LangChain & OpenAI

LangChain

  • A framework to connect LLM and external data
  • It reads data from various resources, transforms, and store
  • Agent: prompt templates, and select functions to call, eg. Pandas
  • Callbacks: hook and flow process
  • Pro:
    • Easy & fast to implement (prompts + LLM API)
    • Wide range of application
  • Con
    • results not stable with the same prompt
    • the change of prompts for fine-tuning exceeds expectations
    • iteration of Agents varies, time-consuming

Technological Advancements

Glue AI applications with Ruby

by Ding Shenghao

Basic Conceptions:

  • Facts: The Facts should be Given, not Inferred
  • Rules: Can be expressed by prolog
  • Facts + Rules → Inference

LangChain

Why Ruby?

  • Ruby is Yet Another Object-oriented Lisp
  • DSL-friendly and Meta-programming-friendly
  • Convention over Configuration

These are my notes from Ruby Conf China; I'll leave you with a group photo at the end of the day.

Ruby-Conf-China-2023-Day-2.jpg

< Back