Latest / CyberSecurity Summary / Learning Vue.js 2: Learn how to build amazing and complex reactive web applications easily with Vue.js
Transcript
- 0:00Speaker 1: Ever feel like you're constantly playing catch up with the
- 0:03Speaker 1: latest tech.
- 0:03Speaker 2: Oh definitely.
- 0:04Speaker 1: One minute you think you're right in the wave, the
- 0:06Speaker 1: next you're wondering like, should I have learned that new
- 0:08Speaker 1: framework last week?
- 0:09Speaker 2: Yeah? It moves so fast.
- 0:11Speaker 1: It's a real challenge, isn't it, staying genuinely well informed
- 0:14Speaker 1: without just drowning in, you know, information overload totally. Well,
- 0:18Speaker 1: today we're hoping to help you cut through some of
- 0:20Speaker 1: that noise. Our deep dive today is into view js two.
- 0:24Speaker 1: It's a really powerful JavaScript framework that's made building reactive
- 0:30Speaker 1: web applications surprisingly accessible.
- 0:32Speaker 2: I think, yeah, it really has.
- 0:33Speaker 1: We're going to explore its capabilities, its core philosophy, and
- 0:38Speaker 1: you know what truly makes it stand out in the
- 0:41Speaker 1: let's face it crowded world of web development.
- 0:43Speaker 2: And for this deep dive, our main source is it's
- 0:47Speaker 2: excellent book Learning VIEWJS two by Olga Philipova, came out
- 0:50Speaker 2: back in December twenty sixteen, okay, and it's just a fantastic,
- 0:56Speaker 2: really practical guide. It takes you through everything from the
- 0:58Speaker 2: basics right up to building you know, complex real world apps.
- 1:02Speaker 1: Great, So our mission today is to really pull out
- 1:04Speaker 1: the most important insights from that source, we'll guide you
- 1:07Speaker 1: through viewjs's origins, its foundational principles, then get practical with
- 1:13Speaker 1: how to actually build applications, test them thoroughly which is key,
- 1:17Speaker 1: and finally deploy them so the world can see them.
- 1:20Speaker 1: All right, should we dive in, let's do it. Okay,
- 1:23Speaker 1: So to kick things off, what's the origin story here?
- 1:27Speaker 1: How did view js even come to be? What's the
- 1:29Speaker 1: behind the scenes tail?
- 1:31Speaker 2: What's actually a pretty classic story sort of necessity breeding invention.
- 1:34Speaker 2: Evan you the creator. He was working at Google Creative
- 1:37Speaker 2: Labs at the time, and he found himself needing a
- 1:40Speaker 2: tool for quickly prototyping large user interfaces. He looked around
- 1:46Speaker 2: at what was available. Then you had Angular widely used
- 1:49Speaker 2: but well quite heavy, yeah, and react to es was
- 1:52Speaker 2: just sort of starting to emerge, but often involved a
- 1:55Speaker 2: more complex MBC architecture, you know, model view controller layers,
- 2:00Speaker 2: standard pattern exactly, and those options they just felt too complex,
- 2:04Speaker 2: maybe too heavyweight for the kind of rapid UI prototyping
- 2:07Speaker 2: he needed to do. I think so Evan saw this
- 2:09Speaker 2: clear gap, you know, for something lightweight, flexible and really
- 2:14Speaker 2: focused on easy reactive data binding with reusable components. That's
- 2:19Speaker 2: really where view began.
- 2:20Speaker 1: So born from a very specific need speed in prototyping,
- 2:24Speaker 1: but it obviously grew way beyond that pretty quickly. Did
- 2:27Speaker 1: What was it about views core design that let it
- 2:29Speaker 1: evolve like that to handle complex, scalable applications? Yeah? How
- 2:33Speaker 1: do you bridge that gap from just prototyping?
- 2:36Speaker 2: That's a great question, and it really boils down to
- 2:38Speaker 2: its core philosophy simplicity and reactivity. Okay, viejs as real
- 2:44Speaker 2: brilliance I think lies in its almost deceptively simple approach
- 2:48Speaker 2: to data. It treats your models as just plain JavaScript objects.
- 2:52Speaker 1: Plain JavaScript objects. H Yeah.
- 2:54Speaker 2: And that wasn't just like a convenience thing. It was
- 2:56Speaker 2: almost a philosophical stand You don't need special syntax or
- 2:59Speaker 2: complex class or you know, an endless list of dependencies
- 3:02Speaker 2: just to define your data. And that drastically lowered the
- 3:05Speaker 2: barrier to entry. It let developers focus on the application logic,
- 3:09Speaker 2: not wrestling with framework stuff, which I mean that's a
- 3:13Speaker 2: huge part of why it gained traction so fast. Makes sense,
- 3:15Speaker 2: And just to clarify some key terms here reactivity and VIEWJS.
- 3:20Speaker 2: That refers to the immediate propagation of any changes to
- 3:24Speaker 2: your data straight to the view layer, so.
- 3:26Speaker 1: Data changes, UI updates.
- 3:28Speaker 2: Instantly instantly exactly. And components they are like self contained
- 3:33Speaker 2: Lego bucks for your app, little pieces with their own
- 3:36Speaker 2: data and view designed to be reused everywhere.
- 3:38Speaker 1: Okay, reusable building blocks.
- 3:40Speaker 2: And two way data binding means changes in the data
- 3:43Speaker 2: model update the view and crucially, changes in the view
- 3:46Speaker 2: like typing in an input field, they reflect right back
- 3:49Speaker 2: into the data model.
- 3:51Speaker 1: That seamless feedback loop precisely. That clarity around data flow
- 3:54Speaker 1: and component sounds really powerful. So with that foundation, how
- 3:58Speaker 1: does the book actually show view dots in action? What
- 4:02Speaker 1: are the practical example? Right?
- 4:03Speaker 2: So the book introduces two very practical applications. There's a
- 4:06Speaker 2: shopping list and a Pomodoro.
- 4:07Speaker 1: Timer okay, classic examples.
- 4:09Speaker 2: Yeah, And the shopping list one is particularly good because
- 4:12Speaker 2: the book first implements it using jQuery for comparison exactly,
- 4:16Speaker 2: and then it does it with VIEWJS, and that side
- 4:19Speaker 2: by side really highlights views elegance and frankly efficiency in
- 4:23Speaker 2: handling things like adding and removing items dynamically compared to
- 4:27Speaker 2: what can become pretty verbose jQuery code I can imagine.
- 4:30Speaker 2: And then the Pomodoro pimer app you know, based on
- 4:33Speaker 2: that time management technique with work intervals.
- 4:35Speaker 1: Yeah, focus bursts, right.
- 4:37Speaker 2: It uses VJs for managing the countdowns, handling all the
- 4:40Speaker 2: state changes, starting, pausing, stopping the timer, switching between work
- 4:44Speaker 2: and rest. It's a great way to see that reactivity
- 4:47Speaker 2: concept really working.
- 4:48Speaker 1: That sound like great learning tools. Yeah. Does the book
- 4:51Speaker 1: also mention how VJs is used out in the wild
- 4:55Speaker 1: beyond these examples, any like big projects or companies using it?
- 4:58Speaker 2: Oh? Absolutely, Yeah. The source points to some really impressive
- 5:01Speaker 2: real world projects that adopted view, which really speaks volumes
- 5:04Speaker 2: about its practicality and scalability Wiku. Well we're talking big
- 5:08Speaker 2: names like Grammarly's online editor uses it, Optimizedly's website testing service.
- 5:14Speaker 2: There's filter Blend, which is a CSS playground, push silver
- 5:17Speaker 2: and invoice service, and also Adera, a Ukrainian online educational
- 5:21Speaker 2: project where the author Olga Philipova is actually the CTO.
- 5:25Speaker 2: They use view too.
- 5:26Speaker 1: Grammarly and Optimizedly. Those are huge. Yeah. That definitely shows
- 5:30Speaker 1: it's not just for small projects or learning. It's clearly
- 5:33Speaker 1: robust enough for serious production grade stuff, no question. Okay,
- 5:38Speaker 1: so we've seen it in action. Now let's get under
- 5:40Speaker 1: the hood a bit what makes VIEWJS work its magic?
- 5:44Speaker 1: What are the the underlying mechanics right?
- 5:47Speaker 2: So, fundamentally, VIEWJS is deeply rooted in the model view
- 5:51Speaker 2: view model architectural pattern or MVVM MVVM okay, and the
- 5:54Speaker 2: view model part that acts as the sort of clever bridge.
- 5:57Speaker 2: It enables declarative data binding between raw data model and
- 6:01Speaker 2: the user interface.
- 6:02Speaker 1: The view declarative meaning you just say what you want,
- 6:04Speaker 1: not how.
- 6:05Speaker 2: To update it exactly. You declare the relationship, and the
- 6:07Speaker 2: view model handles the synchronization. Now that magic of the
- 6:11Speaker 2: instant updates, that's powered by JavaScript's object dot defined property,
- 6:15Speaker 2: specifically its gutters and setters ah.
- 6:18Speaker 1: The built in JavaScript features right.
- 6:21Speaker 2: And what's crucial here is that view isn't constantly like
- 6:24Speaker 2: rechecking everything the way some older frameworks did. Instead, when
- 6:28Speaker 2: you change a piece of data, View's internal watchers are
- 6:31Speaker 2: immediately alerted. They pinpoint exactly what needs updating in the UI.
- 6:35Speaker 2: So it's targeted efficient, very efficient. And here's where things
- 6:39Speaker 2: got really interesting. A major evolution in View two point
- 6:44Speaker 2: zero compared to one point zero was the shift to
- 6:46Speaker 2: a virtual dom.
- 6:47Speaker 1: Right. I've heard that term.
- 6:49Speaker 2: View one point zho directly manipulated the real browser dom,
- 6:52Speaker 2: which could you know, get slow sometimes, but moving to
- 6:55Speaker 2: a virtual dom and view two point zero that was
- 6:57Speaker 2: the key unlock. Also, Mike, i'reating this lightweight blueprint of
- 7:01Speaker 2: your UI in memory. View could figure out the absolute
- 7:04Speaker 2: minimum changes needed and then applied just those changes to
- 7:07Speaker 2: the real browser dom.
- 7:09Speaker 1: So it minimizes the actual slow DOM updates exactly.
- 7:12Speaker 2: It turned what used to be a performance bottleneck into
- 7:14Speaker 2: a massive advantage. It allowed for building really complex dynamic
- 7:18Speaker 2: interfaxes without constantly worrying about performance hits. It wasn't just faster,
- 7:23Speaker 2: it made certain kinds of UIs feasible.
- 7:25Speaker 1: That virtual dom sounds like a genuine game change of
- 7:28Speaker 1: then it really was. Speaking of performance and architecture, How
- 7:31Speaker 1: does viejs stack up against the other big players like
- 7:36Speaker 1: React in Angular.
- 7:37Speaker 2: Good question. Let's start with React in view because they
- 7:39Speaker 2: share quite a bit. Okay, both use a virtual dom,
- 7:42Speaker 2: both are built around reusable components, and both are fundamentally
- 7:45Speaker 2: about reactivity.
- 7:46Speaker 1: Similar core ideas very similar.
- 7:49Speaker 2: A key difference though, often comes down to how you
- 7:51Speaker 2: create components. React famously embraces this everything is JavaScript idea,
- 7:58Speaker 2: often using jsx.
- 8:00Speaker 1: Right that htmail in javascripts and text exactly now.
- 8:03Speaker 2: View can use JSX too, but it's more common practice.
- 8:06Speaker 2: The sort of idiomatic way is to structure components with
- 8:10Speaker 2: distinct template, script and style blocks inside a single dot viewfile, which.
- 8:14Speaker 1: Might feel more familiar to folks coming from traditional web dev.
- 8:17Speaker 2: It often does, yeah now learning curve wise, View is
- 8:20Speaker 2: often described as like out of the blue, simple to
- 8:23Speaker 2: just start using. You can drop it into an existing
- 8:25Speaker 2: page with plain JavaScript. React, on the other hand, typically
- 8:29Speaker 2: requires a bit more initial investment in learning JSX and
- 8:32Speaker 2: modern JavaScript features like e S twenty fifteen classes and erowfunctions,
- 8:36Speaker 2: though those are standard now anyway.
- 8:38Speaker 1: Got it and performance performance.
- 8:40Speaker 2: Wise benchmarks at the time showed View two point zero
- 8:43Speaker 2: is actually even faster than React in many scenarios.
- 8:46Speaker 1: Interesting. Okay, what about Angular versus View right?
- 8:49Speaker 2: The main difference there is that View is significantly less
- 8:53Speaker 2: opinionated than both Angular one and Angular two were, or.
- 8:57Speaker 1: Are less opinionated, meaning more flexible yea.
- 9:00Speaker 2: Less prescriptive about how you structure your entire application. Also,
- 9:04Speaker 2: Angular ones specifically used a technique called dirty checking.
- 9:08Speaker 1: Dirty checking sounds messy.
- 9:10Speaker 2: Yeah, well, it meant that every time something might have
- 9:12Speaker 2: changed in the scope, Angular had to reevaluate all the
- 9:14Speaker 2: watchers to see what needed updating. With lots of watchers,
- 9:18Speaker 2: that could impact performance. Okay, views approach using object dot
- 9:22Speaker 2: defined property is more direct. When a specific property changes,
- 9:26Speaker 2: only that property's watcher gets triggered and reevaluated, much more efficient,
- 9:31Speaker 2: especially in complex apps.
- 9:32Speaker 1: That makes sense. That less opinionated aspect sounds really appealing
- 9:36Speaker 1: for developers who like flexibility.
- 9:38Speaker 2: It's definitely one of its big draws.
- 9:40Speaker 1: Okay, let's circle back to those core building blocks, components
- 9:43Speaker 1: and data binding. Can we get into the nitty gritty
- 9:46Speaker 1: details of how they work in practice?
- 9:48Speaker 2: Absolutely so. Components, as we said, are these self contained units.
- 9:52Speaker 2: They have their own data scope, their own methods. They
- 9:54Speaker 2: can access global application scope, but they encapsulate their own logic.
- 9:58Speaker 1: Right now.
- 9:59Speaker 2: A critical point, especially for components their data and l properties.
- 10:05Speaker 2: The element they mount to must be functions that return
- 10:08Speaker 2: an object, not direct objects themselves.
- 10:11Speaker 1: Okay, why is that so critical?
- 10:12Speaker 2: It's vital to prevent shared state issues when you reuse
- 10:16Speaker 2: a component. Imagine you have a counter component used in
- 10:19Speaker 2: multiple places. If data was just an object, every instance
- 10:23Speaker 2: would share the exact same counter variable.
- 10:25Speaker 1: Oh right, Clicking one counter would increment them all chaos.
- 10:28Speaker 2: Exactly. Making data a function ensures each component instance gets
- 10:32Speaker 2: its own fresh copy of the data state.
- 10:35Speaker 1: Got it. That's a key detail.
- 10:36Speaker 2: And view offers a really elegant way to organize these
- 10:40Speaker 2: single file components. These are files ending in dot feustways. Yeah.
- 10:44Speaker 2: They let you bundle a component's HTML template, its JavaScript logic,
- 10:48Speaker 2: and its CSS styles altogether in one file.
- 10:51Speaker 1: That sounds really clean.
- 10:52Speaker 2: It is. It improves readability, makes components easier to manage,
- 10:56Speaker 2: and it also enables cool development features like hot relf loading.
- 11:00Speaker 2: And you can easily use preprocessors like SaaS for CSS
- 11:04Speaker 2: or PUG for HTML.
- 11:06Speaker 1: Nice. Okay, what about the different ways to actually bind
- 11:10Speaker 1: data to the UI?
- 11:11Speaker 2: Right? If you gives you several techniques, The most basic
- 11:14Speaker 2: is interpolation using the double curly braces.
- 11:17Speaker 1: Like the handlebar syntax exactly.
- 11:19Speaker 2: That's for one way binding, just displaying data values in
- 11:22Speaker 2: the DOM. And inside those braces you can use full
- 11:25Speaker 2: JavaScript expressions and.
- 11:26Speaker 1: Filters expressions like math yeah like.
- 11:29Speaker 2: Mouth output just twenty five. Or you can use custom
- 11:31Speaker 2: filters to format data right there in the template, maybe
- 11:34Speaker 2: a lowercase filter or a left pad filter for numbers.
- 11:37Speaker 2: You can even chain them together.
- 11:38Speaker 1: Handy for formatting.
- 11:39Speaker 2: Very Then you have directives. These are special attributes you
- 11:44Speaker 2: add to HTML elements, always prefixed with V They apply
- 11:48Speaker 2: reactive behavior okay, like v model exactly. V model is
- 11:51Speaker 2: the key one for two way data binding. You typically
- 11:54Speaker 2: use it on form inputs like input select, text area,
- 11:59Speaker 2: user types, something. The data updates, data changes, the input
- 12:03Speaker 2: field updates, but back and forth.
- 12:04Speaker 1: Clop.
- 12:04Speaker 2: Right. Then there's v bind, which you often see shortened
- 12:08Speaker 2: to just a colon like dot src or dot class.
- 12:11Speaker 2: Ah the shorthand hold, Yeah, that's for one way binding attributes,
- 12:15Speaker 2: binding data to an attribute, like setting an image source
- 12:18Speaker 2: dynamically or toggling CSS classes based on data.
- 12:21Speaker 1: Okay, data flowing into the attribute correct.
- 12:24Speaker 2: Then you have v if and v show for conditional rendering.
- 12:27Speaker 1: Right, what's the difference there?
- 12:28Speaker 2: Again, both hyder show elements based on a condition, but
- 12:31Speaker 2: v if actually adds or completely removes the element from
- 12:34Speaker 2: the dom physically gone physically gone, which has a higher
- 12:37Speaker 2: initial cost if the condition changes, but might be better
- 12:40Speaker 2: if it rarely toggles. V show, on the other hand,
- 12:42Speaker 2: just toggles the CSS display none property, so.
- 12:45Speaker 1: The element is always there, just hidden.
- 12:47Speaker 2: Exactly, lower initial cost, always rendered, so it's often better
- 12:51Speaker 2: for things you toggle frequently.
- 12:52Speaker 1: Like tabs. Okay, good distinction.
- 12:54Speaker 2: And finally, V four is super useful for iterating over
- 12:57Speaker 2: arrays or objects. To render lists. You can loop through
- 13:01Speaker 2: data and render and lie for each item, or even
- 13:04Speaker 2: render instances of other custom view components.
- 13:07Speaker 1: Dynamically generating lists very common, extremely common. Those directives really
- 13:11Speaker 1: show off views reactive power. But you know, as apps
- 13:14Speaker 1: get bigger, managing all that state across loads of components,
- 13:19Speaker 1: that sounds like it could get messy fast.
- 13:21Speaker 2: Oh, it absolutely can, and that is precisely the problem
- 13:24Speaker 2: that viex solves. The wix VX is View's official centralized
- 13:28Speaker 2: state management architecture. It's inspired by patterns you might know
- 13:32Speaker 2: like flux or reducts from the React world, right, but
- 13:35Speaker 2: it's generally described as having a much gentler learning curve.
- 13:39Speaker 2: The book calls it easier to understand and to use.
- 13:42Speaker 1: Easier is good. How does it work well?
- 13:44Speaker 2: The book uses this great analogy think of the human
- 13:47Speaker 2: body and brain. Your brain in this analogy is the
- 13:51Speaker 2: viewx store. It is the single source of truth for
- 13:54Speaker 2: your applications. Global state things shared across many components.
- 13:58Speaker 1: The central control exactly.
- 14:00Speaker 2: Now, your components think of them like your hands or
- 14:02Speaker 2: your stomach. They are bound to the state, but they
- 14:05Speaker 2: can only read it directly. They can't just, you know,
- 14:07Speaker 2: directly change how hungry the body feels.
- 14:10Speaker 1: My hand can't decide I'm not hungry anymore precisely.
- 14:13Speaker 2: Instead, components dispatch actions to the brain the store. Hey
- 14:17Speaker 2: I touched something hot, or hey food arrived.
- 14:20Speaker 1: Okay, sending signals right.
- 14:22Speaker 2: These actions can be asynchronous, maybe fetch data, then actions
- 14:26Speaker 2: trigger mutations. Mutations are the only way to actually change
- 14:30Speaker 2: the state, and crucially, they have to be synchronous.
- 14:33Speaker 1: Synchronous. Why is that important?
- 14:34Speaker 2: It makes tracking changes much easier. You know exactly when
- 14:37Speaker 2: and how the state changed because it happens in one
- 14:40Speaker 2: predictable step. This whole structured approach prevents components from just
- 14:43Speaker 2: randomly changing global state, which makes things way easier to
- 14:47Speaker 2: debug and maintain.
- 14:49Speaker 1: I see a clear predictable flow exactly.
- 14:52Speaker 2: So, the key parts of a Vieux store are the
- 14:56Speaker 2: state itself, which is just your centralized data object, mutations,
- 15:01Speaker 2: which are those synchronous functions that change the state. Components
- 15:04Speaker 2: commit mutations, mutations, got it getters, which are like computed
- 15:08Speaker 2: properties for your store's state. They let you derive state
- 15:12Speaker 2: or calculate values based on the state without actually changing.
- 15:16Speaker 1: It by calculating the total price from items.
- 15:18Speaker 2: In a card state, perfect example. And finally, actions these
- 15:23Speaker 2: can handle asynchronous stuff like calling an API. Once they
- 15:27Speaker 2: have the data or finish their logic, they then commit
- 15:30Speaker 2: mutations to update the state. Components dispatch actions, dispatch actions
- 15:35Speaker 2: commit mutations.
- 15:36Speaker 1: Okay, So this whole structure state, mutations, getters, actions sounds
- 15:39Speaker 1: like it brings a lot of discipline, especially to bigger projects.
- 15:42Speaker 2: It really does. It creates this predictable data flow in
- 15:45Speaker 2: a complex app. Trying to figure out where some piece
- 15:48Speaker 2: of state change can be a nightmare. If components are
- 15:51Speaker 2: modifying things.
- 15:52Speaker 1: Directly, yeah, I've been there.
- 15:53Speaker 2: Fux centralizes it. You know what the state is, how
- 15:57Speaker 2: it changes only via mutations and when triggered by actions.
- 16:01Speaker 2: That clarity is massive for debugging, collaboration.
- 16:06Speaker 1: Just keeping things same makes total sense. Okay. So beyond
- 16:09Speaker 1: views core and VIEWX, what if you need some really
- 16:13Speaker 1: specific custom functionality or want to integrate a third party
- 16:17Speaker 1: library smoothly? How do developers handle that?
- 16:20Speaker 2: That's where views plugins system really shines. Plugins are basically
- 16:23Speaker 2: a way to add global level functionality. Global level yeah
- 16:27Speaker 2: things like adding global methods or properties, custom directives, filters,
- 16:31Speaker 2: or even adding methods directly to view instances themselves, things
- 16:35Speaker 2: that aren't tied to just one component. For a plug
- 16:37Speaker 2: in to work, it just needs to provide an install
- 16:39Speaker 2: method that.
- 16:40Speaker 1: View calls okay, an install method right.
- 16:42Speaker 2: The book gives a couple of great examples. First, using
- 16:45Speaker 2: an existing plug in view resource a for HTTP requests exactly,
- 16:49Speaker 2: it shows how to integrate that plug in to let
- 16:51Speaker 2: the shopping list app talk to a back end API
- 16:54Speaker 2: fetching lists, creating items, updating, deleting using a simple tool
- 16:57Speaker 2: called Jason Server.
- 16:58Speaker 1: Jason Server it's super handy.
- 17:00Speaker 2: I lets you spin up a fake rest API really quickly,
- 17:03Speaker 2: just using a JSON file as your database. Great for
- 17:06Speaker 2: development and examples like this. Oh. Then the book also
- 17:10Speaker 2: walks you through creating a custom plug in for the
- 17:12Speaker 2: Pomodoro app. It shows how to build a noise generator plug.
- 17:16Speaker 1: In noise generator like white.
- 17:17Speaker 2: Noise exactly, white pink or brown noise to play during
- 17:21Speaker 2: the work intervals, and the plugin provides methods to control
- 17:24Speaker 2: it start, pause, stop, which are then managed through viewx mutations,
- 17:30Speaker 2: integrating neatly with the app state.
- 17:32Speaker 1: That's a great example of extending functionality building your own
- 17:36Speaker 1: plug in.
- 17:36Speaker 2: It really shows the flexibility.
- 17:38Speaker 1: Okay, so you've built these cool apps, maybe added some plugins,
- 17:42Speaker 1: but how do you make sure they actually work reliably
- 17:44Speaker 1: and you know, don't break when you change something later?
- 17:47Speaker 1: Let's talk testing.
- 17:48Speaker 2: Yes, testing absolutely paramount. The book covers the two main pillars,
- 17:53Speaker 2: unit tests and end to end E two E testing.
- 17:55Speaker 1: Unit tests first, what's the focus there?
- 17:57Speaker 2: Unit tests focus on testing the small TuS pieces of
- 18:00Speaker 2: your code in isolation, individual functions, methods, or components. The
- 18:05Speaker 2: book emphasizes they help us to identify failures and algorithms
- 18:09Speaker 2: in logic, They improve the code quality by forcing you
- 18:12Speaker 2: to write testable code, and crucially, they prevent future changes
- 18:15Speaker 2: from breaking.
- 18:16Speaker 1: The functionality right, catching regressions exactly.
- 18:19Speaker 2: The tools mentioned are pretty standard. Karma as a test runner,
- 18:23Speaker 2: Mocha as the testing framework, Chry for assertions checking if
- 18:26Speaker 2: things are correct, and sign On for creating mocks and stubs,
- 18:30Speaker 2: mox and steps. Yeah, ways to fake dependencies, like if
- 18:33Speaker 2: you're testing a component that calls VUX, you don't want
- 18:36Speaker 2: to involve the real viewx store. You mock it to
- 18:39Speaker 2: control its behavior just for the test.
- 18:41Speaker 1: Okay.
- 18:41Speaker 2: The book gives a good example testing of UX mutation
- 18:45Speaker 2: like a D shopping list. It shows how a test
- 18:47Speaker 2: might initially fail if the mutation doesn't say validate the
- 18:51Speaker 2: input properly. You write the test. It fails, You fix
- 18:53Speaker 2: the code. The test passes, that cycle improves the code.
- 18:56Speaker 2: It also mentions code coverage, a metric showing what percentage
- 18:59Speaker 2: of your code is actually covered by your tests.
- 19:02Speaker 1: Right, aiming for high coverage. Okay, what about end to
- 19:05Speaker 1: end testing?
- 19:06Speaker 2: So end to end E t E testing is different.
- 19:08Speaker 2: It tests the whole flow of the application from a
- 19:11Speaker 2: user's perspective.
- 19:12Speaker 1: Like simulating a real user clicking.
- 19:14Speaker 2: Around exactly no mocks allowed here. Usually you test the
- 19:18Speaker 2: integrated system the front end UI interacting with the real
- 19:22Speaker 2: or near reel back end. It verifies that everything works
- 19:26Speaker 2: together correctly. The book uses Nightwatch dot js, which is
- 19:30Speaker 2: a JavaScript framework that drives Selenium webdriver.
- 19:33Speaker 1: Selenia okay, the browser automation.
- 19:35Speaker 2: Tool right now. A common challenge with E two E
- 19:38Speaker 2: tests is running them in environments without a screen, like
- 19:41Speaker 2: a continuous integration server. Travis CI is mentioned.
- 19:43Speaker 1: A servers don't usually have monitors.
- 19:45Speaker 2: Exactly, so how do you run a browser test? The
- 19:48Speaker 2: solution presented as a tool called XVFB, the x virtual
- 19:51Speaker 2: frame buffer. It basically creates a fake in memory display
- 19:55Speaker 2: that the browser can render to tricking it into thinking
- 19:58Speaker 2: there's a.
- 19:58Speaker 1: Screen clever workaround.
- 20:00Speaker 2: It works really well for CI environments.
- 20:02Speaker 1: Okay, so we've built it, We've tested it rigorously, unit tests,
- 20:05Speaker 1: E two E tests. What's the final step getting it
- 20:09Speaker 1: out there for people to actually use? Deployment? Right?
- 20:12Speaker 2: Software deployment. The book defines it simply as all of
- 20:15Speaker 2: the activities that make a software system available for use,
- 20:19Speaker 2: and it details a really nice continuous deployment process for
- 20:22Speaker 2: the example apps.
- 20:23Speaker 1: It continues deployment meaning automated.
- 20:25Speaker 2: Yeah, setting up an automated pipeline from code commit to
- 20:28Speaker 2: live application. It makes the whole process much smoother and
- 20:31Speaker 2: less error prone.
- 20:33Speaker 1: What tools does it use for that pipeline?
- 20:35Speaker 2: It describes a three step process. One GitHub for hosting
- 20:39Speaker 2: the code repository pretty standard. Two Travis CI for continuous integration.
- 20:45Speaker 2: Travis automatically runs your tests, unit and ETOE every time
- 20:49Speaker 2: you push code to your main branch like master. If
- 20:51Speaker 2: the test pass it gives a green.
- 20:53Speaker 1: Light, so quality check built.
- 20:54Speaker 2: In absolutely and three Heroku, which is a cloud platform
- 20:58Speaker 2: use for continuous deploy. You can figure it so that
- 21:01Speaker 2: after a successful build and test run on TRAVISCI, if
- 21:04Speaker 2: Travis says okay, Heroku automatically takes the latest code, builds
- 21:09Speaker 2: the production version, and deploys it, making it live on
- 21:12Speaker 2: the web.
- 21:12Speaker 1: Wow, that's slick code. Push to live app automatically.
- 21:16Speaker 2: It is that feeling when you merge a feature and
- 21:19Speaker 2: a few minutes later it's live. It's pretty addictive and
- 21:23Speaker 2: this pipeline makes it almost frictionless.
- 21:25Speaker 1: Are there any specific configurations needed for say.
- 21:29Speaker 2: Heroku, Yeah, a few things. You typically need to move
- 21:33Speaker 2: some development only dependencies into the main dependency section in
- 21:36Speaker 2: your package dot json file so Heroku installs them. You
- 21:40Speaker 2: need a post install script and package dot jason that
- 21:42Speaker 2: tells Heroku how to build your app like running NPM
- 21:45Speaker 2: run build okay, and usually need a small serve file
- 21:48Speaker 2: like server dot js using Express, a popular noe js framework,
- 21:52Speaker 2: and a start script in package dot jason to tell
- 21:55Speaker 2: Heroku how to actually run your built application and serve
- 21:57Speaker 2: the static files right. Because Heroka needs to run something
- 22:01Speaker 2: exactly for the shopping list app. It even integrates Jason
- 22:04Speaker 2: Server into this setup, so the same deployed application serves
- 22:07Speaker 2: both the viewfront end and its own little back end API.
- 22:10Speaker 1: A fully self contained deployable unit.
- 22:12Speaker 2: Pretty much. It creates that full automated pipeline code desh
- 22:15Speaker 2: test to desk deploy.
- 22:17Speaker 1: That's a truly comprehensive journey we've mapped out from the
- 22:20Speaker 1: initial idea and core concepts all the way to a tested, deployed,
- 22:25Speaker 1: production ready application. Amazing. Looking ahead just a bit, what
- 22:29Speaker 1: was next for VIEWJS, even beyond the timeframe of this book.
- 22:32Speaker 1: How did it keep evolving?
- 22:33Speaker 2: Well, it's important to remember as the book emphasizes that
- 22:36Speaker 2: View two point zero itself was a major refactor that
- 22:40Speaker 2: shnift to the lightweight virtual dom structure we talked about. Yeah,
- 22:43Speaker 2: that brought huge performance gains. The book quotes benchmarks showing
- 22:48Speaker 2: its performance beats everything at that time. So I View
- 22:50Speaker 2: two was already a big leap forward. Okay, But looking
- 22:53Speaker 2: even further, the book mentions weeks weeks Yeah, a framework
- 22:57Speaker 2: from ali Baba that allows you to write view inspired
- 22:59Speaker 2: component and render them as native mobile applications for iOS
- 23:03Speaker 2: and Android.
- 23:04Speaker 1: Whoa so using view concepts for native mobile exactly.
- 23:07Speaker 2: It hints at views ambition expanding beyond just the web.
- 23:10Speaker 2: The creator, Evan You even said the goal was for
- 23:12Speaker 2: view inspired to become viewpowered native apps that cross platform.
- 23:16Speaker 1: Vision interesting, taking the viewaid to mobile.
- 23:20Speaker 2: And for people who are using View one point zero.
- 23:22Speaker 2: The book also notes that there was a migration guide
- 23:25Speaker 2: and even a helper tool provided by the View team
- 23:28Speaker 2: to make upgrading to two point zero smoother.
- 23:30Speaker 1: That shows good community.
- 23:31Speaker 2: Support Definitely making transitions easier is always appreciated.
- 23:36Speaker 1: What an incredible deep dive this has been. Seriously, we've
- 23:39Speaker 1: gone from the foundational ideas of viewjs its reactivity, through
- 23:44Speaker 1: building components, managing state with viex, using plugins, testing everything thoroughly,
- 23:49Speaker 1: and finally deploying these complex reactive web apps out into
- 23:52Speaker 1: the world. It feels like we've covered the entire life cycle.
- 23:56Speaker 2: We really have. But you know, this deep dive, it
- 23:59Speaker 2: isn't really the end of your journey with viewjas. It's truly,
- 24:02Speaker 2: as the book suggests, just the beginning.
- 24:05Speaker 1: Ah, the learning never stops exactly.
- 24:07Speaker 2: You now have all the fundamental tools and the knowledge
- 24:10Speaker 2: you need to keep exploring to enhance these applications, maybe
- 24:13Speaker 2: build your own, make them your own thing.
- 24:16Speaker 1: So what kind of enhancements could someone try?
- 24:18Speaker 2: Oh? Loads? Think about the shopping list app. You could
- 24:21Speaker 2: add authentication, right, so users have their own private lists.
- 24:25Speaker 1: Yeah, that's a big one.
- 24:26Speaker 2: Or inline editing for item names, a clear checked items button,
- 24:31Speaker 2: maybe configurable styling, let users pick background colors, text colors, fonts.
- 24:36Speaker 2: The book even suggests item categorization with adaptive icons, kind
- 24:40Speaker 2: of like the split wise app does for expenses.
- 24:42Speaker 1: Cool ideas. What about the Pomodora timer.
- 24:44Speaker 2: For the Pomodora application, you could make the working and
- 24:47Speaker 2: resting periods fully configurable by the user, implement longer breaks
- 24:51Speaker 2: after say every four pomodoros.
- 24:54Speaker 1: Standard Pomodora technique rule.
- 24:55Speaker 2: Right, you could display and store user statistics, which but
- 25:00Speaker 2: also need that authentication piece. Maybe let users choose their
- 25:03Speaker 2: preferred noise type from that custom plug. And we talked about.
- 25:07Speaker 1: White, pink or brown noise on demand exactly.
- 25:09Speaker 2: I mean, the possibilities they're really endless once you.
- 25:12Speaker 1: Have the foundation, absolutely, and you don't have to stop
- 25:14Speaker 1: at web apps either, right.
- 25:15Speaker 2: Not at all? Consider extending them. Use tools like weeks
- 25:19Speaker 2: as we mentioned, to try and bring them to mobile,
- 25:22Speaker 2: or maybe turn them into Google Chrome apps, which the
- 25:25Speaker 2: book also touches on briefly.
- 25:27Speaker 1: So take these concepts cross platform.
- 25:29Speaker 2: Why not. You're now equipped. You have all the instruments
- 25:32Speaker 2: you need to enhance these apps, improve them, build new ones,
- 25:36Speaker 2: and show them to the whole world.
- 25:38Speaker 1: A fantastic challenge and a great place to leave it.
- 25:41Speaker 1: You've got the tools, now go build something amazing.