SAFE Part 2: Delete

Thanks to the previous part, the application is beautiful, but there are no interesting interactions.

Once the deletion is implemented, the application will look like this:

Delete with busy

When clicking the Delete button, a spinner appears and then the list is refreshed.

Continue reading “SAFE Part 2: Delete”

Advertisement

SAFE part 1 – Data generation and table

The application works well but it is quite ugly and there is only one person in the list.

Data generation with Bogus

Installation

Bogus is a data generation library for .net and works really well with .net core.

To install a dependency via Paket, open the Server.fsproj, then type Ctrl+Shift+P to open the command prompt, select Paket: add NuGet package (to current project) and then type Bogus. Wait a little bit aaaaaand… done!

Continue reading “SAFE part 1 – Data generation and table”

SAFE part 1 – Persons list

The goal in this part is to list all the contacts.

This part is not really exciting because it will follow the pattern “Replace old stuff with this new stuff”, especially in the first big part.

Then, I’ll introduce some refactorings. It’s a very important part in my opinion and you’ll see many refactoring parts throughout my posts.

I could write nice code directly but I think explaining the process of refactoring is much more helpful than just seeing nice code.

I also prefer to do that because that is the way I work 😀 I try to have something working and then I refactor if I see code smells.

Don’t expect mind-blowind refactorings with generic-factory-decorator-monad-memoization-<insert buzzword>, it will be mostly renaming or file-reorganization, but it is really important for code maintainability.

Continue reading “SAFE part 1 – Persons list”

SAFE part 0 – How it works?

In SAFE, the Client side is written in F# thanks to Fable, but you can follow different paradigms. SAFE embraces the Elm paradigm called Model-View-Update.

Model-View-Update paradigm

MVC-like patterns (MVP, MVVM…) are bidirectional and stateful. The Model layer and View layer don’t know each other and communicate through the Controller layer. For instance, if you have an application with a counter and a button “Increment”, in MVC-like pattern when you hit the button, this is treated like this:

Model-View-Update (MVU) is unidirectional and its state is immutable. The same example in MVU is treated as follows:

Continue reading “SAFE part 0 – How it works?”

SAFE part 0 – Prerequisites

You need multiple things to be installed in order to start this project.

.net core SDK

To install the .net core sdk, follow the instructions described here:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list 
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1.200

Continue reading “SAFE part 0 – Prerequisites”

SAFE Part 0 – Overview

Why ?

I worked all my professional life on C#/WPF but it’s been centuries since I have touched web development! Back in 2005-2006, when I discovered WPF, I remember saying things like “web development is not very fun and web pages will never be as sexy as WPF applications”. We’re now in 2018, I’m still working on WPF fat client applications and web development has changed a lot.

So here am I, looking for HTML/CSS/JS tutorials and enjoying doing small pet projects, discovering a new world (a bit late). One thing I really love is all these languages transpiling to JS with these weird architectures, especially when you are used to MVC or MVVM patterns.

Continue reading “SAFE Part 0 – Overview”

SAFE Tutorial

This post is the main post of a long series about constructing a simple but complete CRUD web application using the SAFE template.

Nothing is really difficult in this series, but there will be some tricky parts (especially when I’ll introduce navigation), so I will do my best to be as clear as possible.

It is a tutorial for beginners by a beginner in web development. So, if I say something stupid, if there is a better way to do something or if you have a question about what I’ve written, please leave a comment, I’ll be very happy to respond and to fix my mistakes 🙂

Have fun!

Why this blog?

I have finally created my blog!

I never really wanted to create a blog because I thought that the web is full of very excellent ones and the gain would be very low. That’s why I follow several great blogs about Clean Code, DDD, functional programming without ever created one.

But, a few months ago, I started to reconsider.

The first reason is that, sometimes, among all the excellent blog posts, there is a blind spot in some subjects. Sometimes, you want something in particular and you need to investigate multiple sources to have a full answer, but you can’t find exactly what you are looking for. So this is the first reason: I want to participate and try to fill some of these “gaps”.

The second and main reason is that I really love to share my knowledge. I love learning new things but what is the point to learn if you keep everything for yourself? Sharing is not only a way to participate in the developers’ community, it also exposes your way of thinking publicly, and consequently to criticism. It is a win-win behavior: either you have a relevant knowledge which will help others to be better developers, either your saying is flawed and other people can point it out, which will help you to evolve on your way of thinking.

So, I hope you’ll find my blog useful, and even if I will mostly speak about C# and F#, it is not only a .net blog and people from other worlds can find interesting things (I hope so 🙂 ).

Have fun!