Writing a website ftp sync service in both C# and F# part 1

2019-07-18 9:46 PM

Although my static site generator framework has suited my needs and been a fun project I have not had a way to easily upload my site when making changes. I've been using a FTP client for now. What I would really like is a deploy command smart enough to know what's different in the new version of my website so it only uploads the minimal amount of files required to fully update the site.

I began to write this functionality in c# but being this is a ongoing project for both fun and learning I've decided to use this as a chance to try to further cross the line from studying functional programming to using functional programming.

What I've decided to do is to design a C# FTP service for syncing my website with an FTP URI and then try to write the equivalent service in F#.

So far it's been quite fun. Here's a quick snippet of what I have going so far :

C#


F#


Tags: park_installation

Back after nearly 3 years

2019-04-09 9:46 PM

resources/images/2019/04/09-RainInstallation01.png

Tags: park_installation

Back after nearly 3 years

2019-03-23 11:46 AM

After almost 3 years the blog is back and I've ditched wordpress for a static site generation library which I authored. There are many reasons I chose to write my own generator rather than use an existing solution. Not good reasons but reasons! Here they are :

Solves my exact use case

Since the target user for this is me I get software that solves my exact use case. It's a rare case to be able to get software so custom tailored to your use case.

Fun

Managing a static website package doesn't sound nearly as fun as writing my own static site generator! I got a change to play with a lot of different .NET libraries.

I really had a great time using the Managed Extensibility Framework (MEF) for reasons I'll explain in the next section. I enjoyed using the Razor templating engine in ASP/MVC so I pulled it out rather than write my own. I used System.Reactive very lightly and for the problems it solved it was really interesting to play with.

Learning and practice

Besides being able to get better aqquainted with a lot of prominent .NET libraries I was able to learn a lot.

At work you usually have to take a fairly conservative approach to designing software but at home I'm free to try all sorts of crazy program designs and since I have no deadline I'm free to heavily refactor and restructure my code repeatedly.

MEF was really useful here. I basically used it as a way to reduce friction when heavily restructuring my program. When my dependencies change I just need to edit a classes importing constructor. I don't need to deal with all the tedium of fixing up constructor calls everywhere.

After working and creating a program I can also now see how I would pull out components of my program into a plugin system if I wanted to make this generator applicable to other websites I would like to make such as a level design blog or a recipe database. The way to design the plugin API is a lot more clear after writing the program. I imagine if I do take the time to write a plugin api it will be a lot stronger compared to if I had designed it before writing a static site generator.

Tags: static_razor