This is a Livecoding Recap – an almost-weekly post about interesting things discovered while livecoding. Usually shorter than 500 words. Often with pictures. Livecoding happens almost every Sunday at 2pm PDT on multiple channels. You should subscribe to My Youtube channel to catch me live.
This weekend I set out to build an idea @TheKitze had on Twitter. An app that gives perspective to your life. Oh, you don't have time to read a book? Well, you spent 5 hours on Twitter yesterday. Are you sure?
Wish there was an app to put "I don't have enough time" or "this costs too much money" into perspective.
— kitze 🚀 (@thekitze) November 18, 2017
Example:
Me: I don't have enough time to read books.
App: You wasted 29 hours on Twitter this week.
Me: 16$ is too much for this book.
App: You ate a fucking 25$ burger.
For the MVP, I envisioned a form where you fill out what you don't have time or money for, ask for some perspective, and the webapp delivers. It doesn't deliver yet because I decided to build it in Vue.
You can see some of my initial struggles with Vue in the video above. In a few bullet points 👇
- Vue's onboarding experience feels like a warm hug. You're immediately showered in community support, example projects, and helpful resources.
- vue-cli is more accommodating to different preferences than create-react-app. It asks questions and tries to configure itself for a good experience.
- The default ESLint config that comes with vue-cli is woefully incompatible with my Prettier config. That was painful. I wish it came with a
.prettierrc
file so it would configure my autoformatter to the settings it expects. - Throwing linting errors instead of warnings by default feels a little forceful. I had to re-make my project from scratch without ESLint.
- Choosing the right VSCode extension to get Vue support… well, there are a lot of them. I ended up going with the Vue Extension Pack. I don't know everything that it did for me, but I'm sure I'll need it eventually.
- Out-of-the-box support for end-to-end testing with Nightwatch is 👌
- The Vue coding experience itself… I think I need to give it more time.
Vue feels like a bastard child between React 13 and Angular 1. I love that it uses and promotes components. That's how it should be. I like that it tries to conform to the web-components standard. It's a good standard, and this will help it come about quicker.
I hate the Angular 1 style v-if
and v-for
stuff where you shove a bunch of complex logic into your templates. I know this is hypocritical coming from the React world where we shove our templates into JavaScript, but somehow that feels more elegant.
Yes, the React approach does lead to some horrendous code when people put too much logic into their JSX.
Yes, it's all about programmer discipline to avoid mixing presentation with logic too much.
And yet, I still feel like it's more elegant to treat HTML as a first-class citizen in your JavaScript than to treat JavaScript as a 2nd class citizen in your HTML.
With React, it feels like my JavaScript directly manipulates what's on the screen. I'm building a UI and have direct control of what's being shown to the user. I can assign pieces of the UI to different variables, treat them as Just Data™, and generally have fun and feel in control.
Vue, on the other hand, enforces an artificial separation of concerns that I don't think is useful. I'm still building a UI and manipulating what's on the screen, but it feels removed. Like trying to tie a knot with 10 foot tweezers instead of your fingers.
With React, I can reach in and get dirty. With Vue, my dandy little hands never touch anything real.
That's what it feels like anyway. shrug
And the syntax for building components feels strange too. Very React 13 where we didn't have proper JavaScript class or function support yet.
export default {
name: "MyComponent"
data() {
return {
data1: "",
data2: ""
}
},
methods: {
doThing() {
},
onClick() {
}
},
components: {
ChildComponent
AnotherChild
}
}
o.O
That, to me, looks weird. Where are all the advances we've made in JavaScript over the past few years?
Why am I defining child components
with an object, internal state, called data
, with a function, and a list of methods
as what looks almost like a class but isn't quite? Feels weird.
I like the React approach where you have a JavaScript class. Its methods are its methods, its props can be state, there's a .state
variable which is the proper connected state, and children are automagically defined by being nested in the component. You know, just like in normal HTML.
Wouldn't it be weird if in HTML you had to declare all the children you're going to use in a certain element?
So far I am more weirded out than impressed. Perhaps with time Vue will grow on me.
🤓
Continue reading about Livecoding 52: First impressions of Vue
Semantically similar articles hand-picked by GPT-4
- Livecoding #27: New React Indie Bundle page almost done
- Livecoding recap #42: HackerNews app where people are nice
- Livecoding #25: Adding MobX to a vanilla React project
- Livecoding #35 - A New Site for reactd3js.com
- Livecoding #26: A new page for a new React Indie Bundle
Learned something new?
Read more Software Engineering Lessons from Production
I write articles with real insight into the career and skills of a modern software engineer. "Raw and honest from the heart!" as one reader described them. Fueled by lessons learned over 20 years of building production code for side-projects, small businesses, and hyper growth startups. Both successful and not.
Subscribe below 👇
Software Engineering Lessons from Production
Join Swizec's Newsletter and get insightful emails 💌 on mindsets, tactics, and technical skills for your career. Real lessons from building production software. No bullshit.
"Man, love your simple writing! Yours is the only newsletter I open and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. 👌"
Have a burning question that you think I can answer? Hit me up on twitter and I'll do my best.
Who am I and who do I help? I'm Swizec Teller and I turn coders into engineers with "Raw and honest from the heart!" writing. No bullshit. Real insights into the career and skills of a modern software engineer.
Want to become a true senior engineer? Take ownership, have autonomy, and be a force multiplier on your team. The Senior Engineer Mindset ebook can help 👉 swizec.com/senior-mindset. These are the shifts in mindset that unlocked my career.
Curious about Serverless and the modern backend? Check out Serverless Handbook, for frontend engineers 👉 ServerlessHandbook.dev
Want to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz React components your whole team can understand with React for Data Visualization
Want to get my best emails on JavaScript, React, Serverless, Fullstack Web, or Indie Hacking? Check out swizec.com/collections
Did someone amazing share this letter with you? Wonderful! You can sign up for my weekly letters for software engineers on their path to greatness, here: swizec.com/blog
Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com
By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤ ️