flaie
Joined 15 years ago
Joined 15 years ago
Opus and GPT are very good at it, it's fast to build and start, convenient to deploy and host, one binary. I like it very much.
Very good stack to iterate fast.
Maybe you could look up the Try monad API (Scala or Vavr works in Java + Kotlin), by using some extra helper methods you can have something probably a little bit lighter to use.
I believe your example would look like the following with the Try monad (in Java):
public UserDTO register(UserRegistrationRequest registrationRequest) {
return Try.of(() -> authService.userExists(registrationRequest.email))
.filter(Objects::isNull, () -> badRequest("user already exists"))
.map(userId -> authService.register(registrationRequest.email, registrationRequest.password))
.get();
}
The login() function would be using the same pattern to call authService.verify() then filtering nonNull and signing the JWT, so it would be the same pattern for both.I have been porting my old solutions in other languages into Kotlin over the time, and will be again doing them in Kotlin. I find it a nice language for AOC since custom extensions and DSL possibilities, it has a good builtin libraries and you can always fallback on Java, even if it has some shortcomings.
Regarding the AOC per se, I take it as a fun daily challenge, I know I won't be able to be part of the top 100, at least I would with some luck during the first 3 days, and then.. nope, that's life, try not to be too competitive. Last year it took me 8 hours to solve day 20, but it's a game, you should have fun doing it (I had), if not people should stop.
However, I strive in trying to write pretty, compact, idiomatic and as functional as possible code, which means that sometimes I will write an ugly solution in 5 minutes, and will take an hour to make it beautiful.
Besides I like to read the story, I know plenty of friends who don't even read the adventures of Santa, they just solve the puzzle and that's it, they don't even know they saved Christmas :-D !
The hardest part is about marketing for me, and I am happy that I first wrote the book for me and see the completion as an achievement, I talked with a lot of people who thought it was kind of easy to get rich just writing books, I don't think so, not easily.
Also, it's really tough to promote a book without feeling like you're over-trying to do it, and regarding an IT book, except for a reddit community, or twitter I wouldn't know where to start.
I have even been invited to online conferences, people seemed to be interested (don't think they were faking it), but it generated zero sales :)
For me, the best way is just to start writing it. I've written a book about a Java library last year named "Practical Vavr" [1], I had the idea since some weeks/months and with the COVID situation having time at home, just told to myself now is the time.
Didn't thought a lot about anything, except for how the book should be laid out, I thought the process was interesting so I went full on it, discovered leanpub and other websites that makes the process easy as just writing some Markdown.
I think that the hardest thing is the marketing around the book, how to tell the world you wrote it and why they should be interested in reading it (and buying it). I just posted it here and there on the web (reddit, twitter mainly), didn't made a lot of fuss about it, I don't know how anyway.
In the end it was more about the experience of writing one and finishing it, than making big money (even if I was able to reach almost 100 people totally unknown people who were kind enough to trust that the content would be good and buy it).
At the time I was 16-17 and knew how to program with PHP (I was modding phpBB at the time), tried with PHP-GTK to build user interfaces, but found it not that great.
Then I discovered Delphi, already knew some parts of Pascal. But what a gem it was, in a matter of days I felt like I was totally proficient, could create windows, manage resize, add components, tweak colors, run background tasks, want a listview? just drag it. Need a HTTP call? drag the component (can't remember the name), connect onclick to it, and you're done. I recall the website torry.net with plenty of libraries to download.
I also tried Borland C++, but wasn't good enough with it, and as I remember discovering that even DevC++ was written with Delphi. Simply figuring out it was good enough for me.
I created so much things with it until like 2004-2005 I think, like a complete terminal on my Windows, re implementing standard commands all within Delphi. Wrote some games companion for Rainbow Six and RavenShield [1], fetching statistics and available servers, scanning games to find your friends, downloaded thousand times. An alt-tab which worked with Quake III that at the time was also downloaded hundreds of times, a companion to The All Seeing Eye (server browsing), a small Photoshop tool where I learnt how to create my own filters like Gaussian blurs and so on [2], key mapping profiles for plenty of games by modifying INI files [3], a code formatter inside DevC++ [4], ...
I have lost all of my source code (didn't knew how to backup things at the time), still have some binaries and screenshots for posterity
I remember this period with nostalgia and great passion.
Thank you Delphi for the good times and all the fun, this is when I really knew what I wanted to do after school.
[1] https://rehost.diberie.com/Uploads/37/20210215-160435-948cd7... [2] https://rehost.diberie.com/Uploads/37/20210215-160351-cc03e0... [3] https://rehost.diberie.com/Uploads/37/20210215-160401-712b1f... [4] https://rehost.diberie.com/Uploads/37/20210215-160338-6f856c... && https://rehost.diberie.com/Uploads/37/20210215-160330-cc512a...