Live data from Hacker News

Goravel: A Go framework inspired by Laravel

goravel.dev

41–50 of 170 posts

Re: Goravel: A Go framework inspired by Laravel

#41
post #21
post #20

I'm not a fan of the complexity added by this and other similar frameworks. PHP and Go are very different languages, so trying to replicate the same concepts for one language to another I don't think it is a good idea. One of the things I would discard would be the use of an ORM library : every library adds another level of complexity and doesn't allow to see what is happening when the SQL statements are built. In my…

> One of the things I would discard would be the use of an ORM library ... In my opinion, it is better to create some simple methods for each object that implement the CRUD operations and build the SQL statements directly. Have you done this for any complex system? I'd love to see you do this for the AzerothCore: it has 298 tables, 3,010,875 rows across those tables, and one table (quest_template) has 105 columns. In…

If you’re only doing CRUD, you can use any reputable query builder or ORM. But sometimes the best model for business logic and the database table differs, and the methods for persistence are Load, Save or Add, Remove instead. That’s when you want custom SQL where the ORM/query builder is not great.

Laravel is great, but that because they have nicely designed escape hatches and their architecture is very modular.

Re: Goravel: A Go framework inspired by Laravel

#43
post #28

Earlier quoted context omitted.

Not sure there's a Go equivalent of Laravel, so not sure which tooling you suggest people adopt. If I want an all inclusive MVC (or similar) web development framework with all batteries included - why not build a Go Laravel? Python has Django Java has Spring (among others) C# has asp.net Ruby has Rails PHP has Laravel What does Go have?

The standard library. It’s honestly feature rich enough to do most things that the only other dependencies we really need to pull in is some third-party SDKs (e.g. AWS) and our database driver.

I assume you have never used Django or Rails or Laravel then. With these, you get a web application with routing, middleware, schema validation, database connections, an ORM, authentication, sessions, job queues, email sending, distributed caching, dependency injection, logging,secret handling, view template rendering, websockets, metrics, and much more—right after the installation, set up with conventions allowing other developers to get productive immediately.

Comparing that to the go standard library is apples to skyscrapers.

Re: Goravel: A Go framework inspired by Laravel

#44
post #21
post #20

I'm not a fan of the complexity added by this and other similar frameworks. PHP and Go are very different languages, so trying to replicate the same concepts for one language to another I don't think it is a good idea. One of the things I would discard would be the use of an ORM library : every library adds another level of complexity and doesn't allow to see what is happening when the SQL statements are built. In my…

> One of the things I would discard would be the use of an ORM library ... In my opinion, it is better to create some simple methods for each object that implement the CRUD operations and build the SQL statements directly. Have you done this for any complex system? I'd love to see you do this for the AzerothCore: it has 298 tables, 3,010,875 rows across those tables, and one table (quest_template) has 105 columns. In…

Yes, I understand your point of view, but in my experience these ORM libraries when you create a class or a structure and then the library build the SQL code behind the scenes can suffer from some relevant issues :

1. you have no control over the generated SQL and because it has to be generic and db agnostic, might not be the best option depending on the database you are currently using

2. when something doesn't work as expected, and it happens, they are difficult to debug (too many layers) and find the issue

3. they are extremely inefficient, because they have to dynamically build every time the code is run the corresponding SQL code : I'm sure most would implement some caching mechanism to prevent this , but in any case it's a waste of resources.

This is just anecdotal, but I remember trying SQLAlchemy many years ago for a small Python program I was writing for a RaspberryPi 3 : it was extremely slow. So, I removed the library and used instead the native database binding for MariaDB instead, and the speed improved a lot.

For PHP, the situation is the worst because there is no application server (they exist, but not very widely used), but the code is regenerated every time. This is the main problem in any large PHP project, such as Nextcloud. If they would adopt FrankenPHP or RoadRunner, they could improve the performance of the applications a lot.

Re: Goravel: A Go framework inspired by Laravel

#45
post #32

It seems like every middling company out there wants to bolt in popular architecture from other languages into Go, particularly Java enterprise patterns. Why not use the actual language or framework your engineers like instead?

I don't think Laravel is particularly GoF-ish, if that's what you mean. In terms of patterns it's mostly fairly simple. > Why not use the actual language or framework your engineers like instead? Go does not provide "enough" by itself to completely furnish my needs. And having a framework that uses common terminology and patterns allows you to get s__t done and not waste time bikeshedding. "Microservices are cattle,…

Could you give a few examples what such frameworks provide that you need, that Go plus a few simple libraries doesn't provide?

Re: Goravel: A Go framework inspired by Laravel

#46

Earlier quoted context omitted.

I don't think Laravel is particularly GoF-ish, if that's what you mean. In terms of patterns it's mostly fairly simple. > Why not use the actual language or framework your engineers like instead? Go does not provide "enough" by itself to completely furnish my needs. And having a framework that uses common terminology and patterns allows you to get s__t done and not waste time bikeshedding. "Microservices are cattle,…

Could you give a few examples what such frameworks provide that you need, that Go plus a few simple libraries doesn't provide?

It's a long list. It might be more productive to start with just one example: OpenAPI validation.

In large orgs with customer-facing APIs, it's imperative that you can validate and enforce OAS specifications against all routes. Customers need to know exactly what auth mechanisms they can use and shouldn't be enabled to call undocumented capabilities. It's also important from a practical perspective that developers can scaffold up new routes that are always-already bound to a specification. Depending on the context you either need to do "contract first" specification or "code first" generation based on type system introspection.

Go can let you knock something together yourself but as your team gets larger, the overhead of reviewing and marshaling your team's practices gets more and more difficult.

It's like the problem you have with NodeJS. It's very possible to assemble something that has easy to scaffold routes with strong type-to-spec validation, authn/z, no exposure of undocumented APIs. But without something like NestJS or Adonis each project becomes a special snowflake with no support for interop across repositories.

Re: Goravel: A Go framework inspired by Laravel

#47
post #21

Earlier quoted context omitted.

> One of the things I would discard would be the use of an ORM library ... In my opinion, it is better to create some simple methods for each object that implement the CRUD operations and build the SQL statements directly. Have you done this for any complex system? I'd love to see you do this for the AzerothCore: it has 298 tables, 3,010,875 rows across those tables, and one table (quest_template) has 105 columns. In…

If you’re only doing CRUD, you can use any reputable query builder or ORM. But sometimes the best model for business logic and the database table differs, and the methods for persistence are Load, Save or Add, Remove instead. That’s when you want custom SQL where the ORM/query builder is not great. Laravel is great, but that because they have nicely designed escape hatches and their architecture is very modular.

SQLAlchemy doesn’t get in the way of anything you might want to do. In fact, you can do a “textual” query and then have the response mapped to classes for you :-)

Re: Goravel: A Go framework inspired by Laravel

#48
post #40
post #20

I'm not a fan of the complexity added by this and other similar frameworks. PHP and Go are very different languages, so trying to replicate the same concepts for one language to another I don't think it is a good idea. One of the things I would discard would be the use of an ORM library : every library adds another level of complexity and doesn't allow to see what is happening when the SQL statements are built. In my…

The ORM question is a very good example for the issue you describe. Laravel is great to get a CRUD app started right now , iterate very quickly, and leave implementation complexity to the framework. This isn’t the right tool for every job, but it shines at those where it is. For example, you can drop an engineer with Laravel experience in pretty much any Laravel codebase, since the conventions are so strong, they’ll…

> While you’re still researching the best SQL library for a project

People do this? In every language I've worked with, there's practically just one SQL library to use. And you just write a query, execute it, and map some results. Very basic.

Re: Goravel: A Go framework inspired by Laravel

#49
post #24
post #20

I'm not a fan of the complexity added by this and other similar frameworks. PHP and Go are very different languages, so trying to replicate the same concepts for one language to another I don't think it is a good idea. One of the things I would discard would be the use of an ORM library : every library adds another level of complexity and doesn't allow to see what is happening when the SQL statements are built. In my…

What would you use if ORM is to be avoided? Perhaps something like https://github.com/sqlc-dev/sqlc ?

My advice is to just use standard library `database/sql`. Every abstraction on top adds extra complexity and isn't really necessary. Just execute a query, map the results, and there you go.

Re: Goravel: A Go framework inspired by Laravel

#50
post #44
post #21

Earlier quoted context omitted.

> One of the things I would discard would be the use of an ORM library ... In my opinion, it is better to create some simple methods for each object that implement the CRUD operations and build the SQL statements directly. Have you done this for any complex system? I'd love to see you do this for the AzerothCore: it has 298 tables, 3,010,875 rows across those tables, and one table (quest_template) has 105 columns. In…

Yes, I understand your point of view, but in my experience these ORM libraries when you create a class or a structure and then the library build the SQL code behind the scenes can suffer from some relevant issues : 1. you have no control over the generated SQL and because it has to be generic and db agnostic, might not be the best option depending on the database you are currently using 2. when something doesn't work…

I too used to believe those were valid points not to use an ORM back in the day. That was easily 2013/2014. Since then I’ve never found an ORM that gets in the way letting my just run raw SQL. And not just run raw SQL as complex as I’d like: it’ll also still give you all the magic once the response comes back.
Post reply on HN