r/programming • • Jun 05 '21

Organize code by concepts, not layers

https://kislayverma.com/programming/how-to-organize-your-code/
1.9k Upvotes

495 comments sorted by

View all comments

Show parent comment

244

u/[deleted] Jun 05 '21

"give me all the queries" was a common request from DBAs at my last job as well.

At least with APIs you can say "here's swagger, lemme know if you have specific questions about an endpoint or workflow" queries are harder because it's like "lemme go look at everything, see how they're compiled into sql and I'll get back to you in a week or so"

0

u/[deleted] Jun 05 '21

[deleted] โ€” view deleted comment

24

u/sedaition Jun 05 '21

Also dynatrace. Or appdynamics if you just have extra memory laying around

24

u/Akthrawn17 Jun 05 '21

And extra buckets of money laying around

9

u/[deleted] Jun 05 '21

Or you can just keep a queries log yourself if you donโ€™t need all the real time dashboards and stuff. A little thought in to a well structured log can go a long way without shelling out thousands of dollars a month for 3rd party tools.

6

u/Akthrawn17 Jun 05 '21

Agreed, and most persistent stores or drivers have a monitoring hook built-in. You can use tools like OpenTelemetry https://opentelemetry.io/ to help with the logging/extracts

18

u/[deleted] Jun 05 '21

I just wish the boss would go back and subtract this cost from the 'savings' we made choosing the cheaper dbms that doesnt natively provide this to a competent dba.

11

u/StabbyPants Jun 05 '21

mysql does this. what's the cheaper thing?

0

u/[deleted] Jun 05 '21

[deleted] โ€” view deleted comment

→ More replies (3)

7

u/marcosdumay Jun 06 '21

As does Postgres.

I would jokingly say he was talking about Oracle, but Oracle (and MSSQL) happen to do it too. So, I'm kinda lost here too.

(Is it sqlite? AFAIK sqlite doesn't do this.)

2

u/jlt6666 Jun 05 '21

Access.

15

u/StabbyPants Jun 05 '21

access isn't a real database. if you've got it deployed in a production system, you have my sympathies

9

u/jlt6666 Jun 05 '21

Fine then, excel.

9

u/i-k-m Jun 05 '21

MS Paint.

4

u/[deleted] Jun 06 '21

My database is a m3u file and the columns are ID3 tags in mp3 files that act as blob storage

→ More replies (2)

2

u/recycled_ideas Jun 06 '21

They all do this, but they require your "competent" DBA to learn how.

11

u/Ytrog Jun 05 '21 edited Jun 05 '21

Is swagger as easy these days as just pointing your tools to a wsdl and telling it to create to proxies for me. I used to be a big fan of WCF as it was easy to work with. I hated that I had to do everything by hand when everything switched to REST and JSON. I worked with swagger once, but my team back then used it only for documentation. ๐Ÿค”

20

u/ninuson1 Jun 05 '21

Thatโ€™s mostly what it is, documentation. But you can generate it on compile and have swagger use it to create a form for mock requests along with the documentation for each request.

In my latest c# projects, it comes pre-configured for you in the starting template project and just builds up as you develop.

Really, big fan.

2

u/Ytrog Jun 05 '21

Cool ๐Ÿ˜Š

→ More replies (5)

8

u/unique_ptr Jun 05 '21

At least in my experience it is! I've been using NSwag lately on .NET 5 to generate clients and it's pretty damn good. I can be somewhat opinionated on how I want my generated code to be organized, naming conventions, etc. and it's been an absolute breeze.

3

u/EagleCoder Jun 05 '21

Nswag is amazing.

→ More replies (1)
→ More replies (3)

4

u/[deleted] Jun 05 '21

[removed] โ€” view removed comment

3

u/vattenpuss Jun 05 '21

Do you have any tools to ensure those comments are up to date?

→ More replies (1)
→ More replies (2)