Live data from Hacker News

Goravel, Web framework inspired from Laravel in Golang

github.com

51–60 of 64 posts

Re: Goravel, Web framework inspired from Laravel in Golang

#52
post #11

Earlier quoted context omitted.

AFAIK, no. There are some helper frameworks [1], but none of them is dominant. Two possible reasons: it's quite easy to write a (web) service with the library functions (it even includes a gzip stream), and it's practically impossible to write an ORM framework like you have in Java and Python, so the Go frameworks I've seen are basically a bunch of helper functions. [1] https://github.com/avelino/awesome-go#web-frame…

> impossible to write an ORM framework like you have in Java and Python genuinely interested in knowing why it is so. I quite like Go, but I also like Django, so I would like to know why a Django-like ORM would not be feasible.

I thoroughly dislike Django.

But if you look at how it works in Python, it's by taking over class definitions in such a way that a field can be both a description of the field and an actual value. That doesn't work in Go (explicit casting the fields at every place you use them could work, but is prone to errors). It "cleverly" overrules operators to turn something like the Python expression `age > 50` into the sql string `age > 50`. Can't be done in Go, unless you define functions for all operators and find a way to reflect on the field name and the current context (`gt("age", 50)`). That's a lot of work to turn one string into the same one. URLs can't be linked to a class by simply importing a file; you'd need to add quite a bit of scaffolding (a factory for each class with a common interface, I guess?). And there are other parts that rely on annotation and whatever that simply can't be ported to Go, so you'd have to turn them into function calls. And Django doesn't give you more than a glorified POST form app out of the box anyway. You have to add more views and serializers to turn it into a modern backend, so why not skip that and use libraries that implement the functionality you do need.

Ok, my dislike shines through, but the gist is that Go doesn't let other code take over the interpretation of the meaning of expressions and statements and inject things into classes like Python does. It all has to be done explicitly. So django-like functionality for Go would have to look very different.

Re: Goravel, Web framework inspired from Laravel in Golang

#54
post #20

Earlier quoted context omitted.

When I studied computer science, I promised myself to never touch PHP again. But PHP has more to give than just as a birthing ground for teenage programmers. When I many years later accepted a PHP job as a senior developer, PHP provided a consistent experience of "bad practice everywhere", a fractal of cringe I couldn't ironically reproduce. Working with this for a year taught me a lot about how to deal with critical…

Many of my programming jobs in PHP had me working with people that were super anal about "good coding practices". Especially the Symfony guys seem to try to be the new ultra-corporate Java. So I don't think it a issue with the language but more that you didn't find your people. (Personally, I actual like working with legacy crap. It's easy money and reminds me of the past when things were simpler.) I feel most of the…

> I don't think it a issue with the language but more that you didn't find your people

I can be more specific: I'm identifying problems with the language ecosystem.

I deliberately didn't shit on the people involved; I'll definitely ride the #not-all-php-programmers (I've met some great ones), but it takes a broken mind to accept a toolchain this historically fallible as something with which you'd want to recreate the Java ecosystem. ;-)

Have you tried Java?

It's definitely a better Java than PHP!

Re: Goravel, Web framework inspired from Laravel in Golang

#55

Earlier quoted context omitted.

So they roll their own stuff each time they do a web app?

Composition is king. The standard library defines some decent interfaces already around HTTP handling and SQL calls. Most libraries are built to integrate with them. Then interfaces like io.Reader and io.Writer mean you can pretty much use anything to read requests and write responses. This means that usually you're composing libraries and some application code together, rather than building everything on top of some…

> Then interfaces like io.Reader and io.Writer mean you can pretty much use anything to read requests and write responses.

Yeah, that’s not the hard part at all. What about routing, converting from/to json/params/cookies safely, sessions, authz/n..

Re: Goravel, Web framework inspired from Laravel in Golang

#56
post #52

Earlier quoted context omitted.

> impossible to write an ORM framework like you have in Java and Python genuinely interested in knowing why it is so. I quite like Go, but I also like Django, so I would like to know why a Django-like ORM would not be feasible.

I thoroughly dislike Django. But if you look at how it works in Python, it's by taking over class definitions in such a way that a field can be both a description of the field and an actual value. That doesn't work in Go (explicit casting the fields at every place you use them could work, but is prone to errors). It "cleverly" overrules operators to turn something like the Python expression `age > 50` into the sql st…

> why not skip that and use libraries that implement the functionality you do need.

I was just asking specifically about the ORM part. The subject of "use an opinionated framework vs. tie specialized libraries together" is a complete different debate.

But about this matter: I quite like to assemble libraries when I'm solo on a personal project. But that's definitely not something I want in a team. That's pretty much why we go with Django and not Flask or any of the "lightweight", "micro" framework things that are everywhere. "Just bring whatever ORM you want", "Use whatever template engine you like", etc. But that's a lot of decision making and integration with no added value for us. The fact that Go has such a comprehensive standard library is a good thing, but probably not enough because, like you wrote:

> you'd need to add quite a bit of scaffolding

(Which obviously contradicts the idea that Django brings just a glorified POST form app to the table)

As to why I'm interested in Go: faster execution, less memory, easier deployment... but as a small shop, team productivity still comes first.

Re: Goravel, Web framework inspired from Laravel in Golang

#57
post #17

Please, no. While you can write really clean code in modern PHP, Laravel is a collection of anti-pattern. PHP has a bad reputation because in the past it was hard to implement clean code because of inconsistencies and lacking language features. PHPs reputation should improve, but Laravel is working against it. Please don't bring Laravel to Go.

Can you give a concrete example of what you mean by “Laravel is a collection of anti-pattern?” I would really love to understand what you are referring to.

There was a reddit link posted under another thread, which had a very extensive list.

Re: Goravel, Web framework inspired from Laravel in Golang

#58
post #28

Earlier quoted context omitted.

I think the reddit post missed the point multiple times. Laravel does not use the best principles everywhere, yes. Taylor Otwell is a (very) strange person, yes. But "Laravel should be considered harmful for the PHP community" is just wrong. Laravel was the first framework, that "just worked" and had everything, you need to make your first steps in a web application. Nowadays, people write PHP components that are usa…

"Laravel was the first framework, that 'just worked' and had everything" - well, there was Symfony before. And CakePHP, and Yii (which was also considered as quite easy to learn), and much more. Laravel may did a few things "better", especially for junior devs, but it's not the first.

I tried CakePHP at the time and it was awful, like many other PHP frameworks of the time (remember joomla?). Frameworks were either "what the framework provides is easy, but don't dare to do anything that the framework is not made for" or "just do what you want, we provide almost no help, just figure it out by yourself". And all of them were slooooooow. It wasn't possible to answer a web request in under 50 milliseconds with any PHP framework in 2008.

Laravel was awful when everyone else were awful. But around Laravel 5.5 (and PHP 7) it was complete enough, documented enough and fast enough, that you could just start building stuff with it without having to think about it. Is Laravel the best Framework out there? Not at all! But is also not considered harmful, far from it.

Re: Goravel, Web framework inspired from Laravel in Golang

#59
post #55

Earlier quoted context omitted.

Composition is king. The standard library defines some decent interfaces already around HTTP handling and SQL calls. Most libraries are built to integrate with them. Then interfaces like io.Reader and io.Writer mean you can pretty much use anything to read requests and write responses. This means that usually you're composing libraries and some application code together, rather than building everything on top of some…

> Then interfaces like io.Reader and io.Writer mean you can pretty much use anything to read requests and write responses. Yeah, that’s not the hard part at all. What about routing, converting from/to json/params/cookies safely , sessions, authz/n..

I'm a fan of gin over the builtins but:

> What about routing, converting from/to json/params/cookies safely All supported out of the box with the standard library. It's also table stakes, and not the hard part.

> sessions, authz/n

This is where you need to step out of the standard

Re: Goravel, Web framework inspired from Laravel in Golang

#60
post #47
post #14

Earlier quoted context omitted.

Also not OP, but the linked reddit post sums up one of the major reasons I had to get out of PHP several years ago. Everything is/was moving to Laravel in PHP land. I got tired of dealing with highly coupled, non-unit testable code that seemed to go out of it's way to ignore SOLID principles. God help us if it this project becomes the normal way of writing http go servers applications. Maybe at that point it's time t…

People like you, not meant personally, are the reason I abandoned PHP. Too much dogma. Too much nonsensical paradigms without considering pragma. Who gives a shit about SOLID or OO. I used to love PHP for its simplicity. That was before zealots of your type flooded the ecosystem. You wanted to apply what they taught you in uni, which was Java, to PHP. PHP was fine before. I earned good money with it and had fun doing…

> Who gives a shit about SOLID or OO.

The people who care about and are tasked with maintaining a large long running code base.

> You wanted to apply what they taught you in uni, which was Java, to PHP.

Nope, that came after my time.

> Can't you booksmart idiots STFU for once and let people do the pragmatic and sensible approach? I earned good money with it and had fun doing so. Then 2010 the next generation of clueless devs enters the scene, polluting it with their nonsense.

Those OO & OOP principles are the pragmatic and sensible approach learned after cleaning up after "hipster" web "artisans". If we're going to throw around claims without knowing anything about the other person; you sound like the kind of dev who writes some code that works on the happy path, but is completely unmaintainable and non-extensible.

(But I know nothing about you, so I really have NFI, just like you have NFI about me and what I do)

Post reply on HN