Hi everyone! I've recently decided that I want to ...
# server
t
Hi everyone! I've recently decided that I want to rewrite my currently static portfolio website/blog as a dynamically served website with a server (mainly with the purpose of adding additional functionality). I love Kotlin and when looking into using it for the server I came across ktor and exposed which I think I would work well together. However, most of the server-side code I've written has been in Ruby under the Rails framework, which is super opinionated and pushes for a predefined structure that I certainly followed. Now I've started working with ktor and exposed and I'm a bit at a loss for how to organize my code. Have any of you figured out a way to organize your classes, functions, files, etc. that's scaled well?
t
most people recommend package by feature, so if you have
blogposts
on your website, you'd do
Copy code
blogpost
    BlogPost // data class
    BlogPostController // business logic
    BlogPostDao // database access
then make one package per feature your website has
m
It doesn’t matter too much because it’s pretty easy to change later because there’s so much better tooling in Kotlin than in Ruby… rearrange stuff to your heart’s content and the IDE / compiler will make sure you get it right. 🙂
t
Okay thanks! I'll try that
j
You can still develop spaghetti in any language incl. Kotlin 🙂