"Impact of front-end architecture on development cost", Viktor Turskyi

fwdays 282 views 56 slides May 27, 2024
Slide 1
Slide 1 of 56
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56

About This Presentation

I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails...


Slide Content

Frontend development
approaches that reduce the risks
of project failure


Viktor Turskyi

JavaScript fwdays’24
●20 years in IT
●13 years in software business
●Delivered more than 80 projects of
different scale
●Did 15 projects for 5 companies from
Fortune 500 list
●3 years at Google
●youtube.com/@AboutProgramming

Is High Quality Software Worth
the Cost?
JavaScript fwdays’24

Do we need architecture for
frontend?
JavaScript fwdays’24

“If you think good architecture is
expensive, try bad architecture.”
—Brian Foote and Joseph Yoder


JavaScript fwdays’24

What is most popular
architecture today?
JavaScript fwdays’24

Big Ball of Mud
http://www.laputan.org/mud/mud.html#BigBallOfMud

JavaScript fwdays’24

JavaScript fwdays’24
Source: https://martinfowler.com/articles/is-quality-worth-cost.html

JavaScript fwdays’24
Source: https://martinfowler.com/articles/is-quality-worth-cost.html

What is the best architectural
decision?
JavaScript fwdays’24

Robert Martin
“The job of architect is not to make decision, the
job of the architect is to defer decisions as long
as possible”

“Good architecture maximizes number of
decisions not made”
https://www.youtube.com/watch?v=o_TH-Y78tt4

JavaScript fwdays’24

How can we make better
architectural decisions?
JavaScript fwdays’24

Solution is in technical domain
but problem statement in
business/product domain.

JavaScript fwdays’24

Understand business/product
domain. Focus on business
problems

JavaScript fwdays’24

Why to understand domain?
●Problems you solve comes from domain. Otherwise you will solve wrong problems.
●Requirements (including non functional) comes from domain.
●Creating good Domain Model requires understanding the domain
●Simplifies communication with stakeholders (you talk to them using their
language)
●Simplifies adding new changes
●Psychological comfort. Engineers prefer to write products that they understand.

JavaScript fwdays’24

Conduct business/product
trainings
JavaScript fwdays’24

Universal approach for better decisions
1.Always ask yourself “What problem do we want to solve?”
2.Find several potential solutions (not all possible, two can be enough)
3.Select the best solution for your problem

Let’s discuss problem microservices case again.
JavaScript fwdays’24

How to make “better” design?
●Understand business/product domain
●Understand technologies deeply
●Optimize for change
●Assemble first
●Think about abstractions

JavaScript fwdays’24

Why to understand technologies deeply?
●You cannot choose right technologies without knowing their properties
●You cannot know their properties without knowing implementation details
What will happen to DB if you will increase amount of data 10 times? Can you answer
that without knowing how indexes work?
Docker vs VMs? What are the properties? (Why docker is slow on OSX?)
Is MongoID secure as a token for password recovery?
React Native is native or not native?


JavaScript fwdays’24

Optimize for
change
One of Agile Manifesto principles:

Welcome changing requirements, even late in
development. Agile processes harness change
for the customer's competitive advantage.


https://agilemanifesto.org/principles.html

JavaScript fwdays’24

How to optimize for change?
●Do not write code which support everything. In this case, the result will be
opposite.
●Expect changes! Evaluate risks
●Simplify (simplicity and easiness is not the same, “Simple made easy”)!
●Good abstraction but without overengineering. Reduce coupling, increase
cohesion.
●Stay in touch with product managers (while you developing A they are already
thinking about B)

JavaScript fwdays’24

Can we predict future?

JavaScript fwdays’24

Talk to product managers - they
live in future

JavaScript fwdays’24

Assemble first principle
JavaScript fwdays’24

https://webbylab.com/cases/mercedes/

JavaScript fwdays’24

How to organize work on this?
JavaScript fwdays’24

What does it mean to assemble first?


●Create abstractions
●Think about data which goes through your system
●Implement behaviour just with simple boxes
●Iteratively add details to each box
JavaScript fwdays’24

Why to assemble first?


●You will have abstractions of components that really fit each other
●You will have end-to-end working functionality early to and will get early feedback
●Feature owners can test their own pieces in fully working environment
●You can discover risks as earlier
●Early integration becomes possible
●Much easier to parallelize the work
●Not having time to deliver 100% will allow you to compromise on some visuals
than on end-to-end experience for case when you assemble at the very end
JavaScript fwdays’24

https://blog.udemy.com/how-to-draw-a-realistic-cat-step-by-step/
JavaScript fwdays’24

https://blog.udemy.com/how-to-draw-a-realistic-cat-step-by-step/
JavaScript fwdays’24

Does it guarantee success? No!
JavaScript fwdays’24

Priorities/Commitment
P0 - must
P1 - should
P2 - might
JavaScript fwdays’24

https://blog.udemy.com/how-to-draw-a-realistic-cat-step-by-step/
P0, P1, P2 P0, P1
P0
JavaScript fwdays’24

Abstractions
JavaScript fwdays’24

What are good abstractions
●They are usable. Think how they will be used while designing them
●You can understand them. You should be able to predict system behaviour
●You should know where to put specific code
●Tests are just statistical proofs that something is working
●They are not dependent on context
●Low coupling
●High cohesion
JavaScript fwdays’24

Developes are afraid of new abstractions
●Story about Test factory and assertDate method
●Story about Controllers/Mediators/Managers in UI
●Story about Extra behaviour in slides engine
●Story about Builders for UI components
●etc

JavaScript fwdays’24

Level editors concept
JavaScript fwdays’24

Universal toolkits
JavaScript fwdays’24

Builders
JavaScript fwdays’24

Type of builders
●Form Builder
●Dialog Builder
●Grid Builder
●Page Builder

JavaScript fwdays’24

Form builder schema
{
api: { load: (id) => {} , save: (data) => {}},
inputs: [
{field: ‘name’, type: ‘text’, label: ‘Name’}
],
}
JavaScript fwdays’24

Form builder
function UserEditForm({id}) {
const schema = {...}
return <FormBuilder schema={schema} />
}
JavaScript fwdays’24

Dialog builder
function UserEditDialog({id}) {
const schema = {
title: ‘Edit dialog’,
formSchema: {}
}
return <DialogBuilder schema={schema} />
}
JavaScript fwdays’24

Grid builder schema
source: { list: Promise.resolve(data)},
columns: [
{field: ‘id’, type: ‘id’, label: ‘Id’},
{field: ‘name’, type: ‘url’, label: ‘Name’, urlFormatter: (user) => `/users/${user.id}`}
],
rowActions: [
{icon: <DeleteIcon />, label: ‘Delete’, confirm: true },
{icon: <EditIcon />, label: ‘Edit’, action: (row) => {
dialogService.open(UserEditDialog, {id: row.id})
}],
JavaScript fwdays’24

Grid builder
function UsersGrid() {
const schema = {...}
return <GridBulder schema={schema} />
}
JavaScript fwdays’24

Page builder
{
title: ‘users’,
layout: {component: MainLayout, props: {selected: ‘users’} },
gridSchema: {...},
}
JavaScript fwdays’24

Builders pros
●You have consistent behaviour across your UI
●Increases development speed a lot
●Can be iteratively updated each time you have a new requirement
●Easier to design
●Minimum extra time for development as the features should be done in any case

JavaScript fwdays’24

Is technical debt a bad thing?
JavaScript fwdays’24

Some thoughts on technical debt


●Doing things the quick and dirty way sets us up with a “technical debt”, which is
similar to a financial debt.
●Another metaphor is “Pollution”. Pollutants gradually affect people and as time
passes by, makes it exponentially harder and costly to fix it.
●You can't cook food without dirtying the dishes. Clean the kitchen after cooking
●You introduce technical debt even if all you do is just write similar code.

JavaScript fwdays’24

Some thoughts on patterns and best
practices


Pattern is just a common solution (not a secret solution) which works for a common
problem.
Ask yourself why such pattern or best practice does exist and be ready to not follow it if
this “why” is not related to your case.


JavaScript fwdays’24

Chat example
Let’s design together
JavaScript fwdays’24

@turskyi
Viktor
Turskyi
Thank you