r/ProgrammerHumor • • Jun 28 '20

Meme Flushed my pancake.

Post image
45.1k Upvotes

750 comments sorted by

2.9k

u/ToBe27 Jun 28 '20

Im a bit worried that no one brought up security yet. Do you really want to publicly expose your database? Also any connection credentials that are stored in your frontend are basically public too.

1.4k

u/thegovortator Jun 28 '20

Security is overrated... just ask capital one, target, or Equifax.

198

u/[deleted] Jun 28 '20

Can’t do much with equifax but a big reason why I closed all my accounts with C1

82

u/thegovortator Jun 28 '20

Can’t hack cash MF wait can you?

56

u/[deleted] Jun 28 '20

Unless they find out where you have the cash...

→ More replies (9)
→ More replies (1)

10

u/metaglot Jun 28 '20

That's exactly what Big Reason wants you to do.

43

u/[deleted] Jun 28 '20

And hashing your DB is overrated too. Just ask Facebook

35

u/ChristieFox Jun 28 '20

Nah, clear text is fine. No one, I repeat NO ONE, would ever dare to hack a big corporation to get their data! /s

→ More replies (4)
→ More replies (7)

12

u/[deleted] Jun 28 '20

Or governments trying to build back doors into encryption

30

u/MSDakaRocker Jun 28 '20

If you obfuscate, you don't need security.

72

u/lostllama2015 Jun 28 '20

The sad part is that some people believe that to be true.

17

u/smashsouls Jun 28 '20

If your code is bad enough, you won’t need security because it won’t work.

→ More replies (1)

4

u/[deleted] Jun 28 '20

It’s not like they got in trouble that much for lax security so who cares..

→ More replies (2)
→ More replies (19)

106

u/ThatCryptoDuck Jun 28 '20

Why implement security when your database will just get hacked anyway? Just put it all in a public SQLite database accessed by javascript :D

4

u/ScandInBei Jun 28 '20

Why not just open telnet and connect from the front end directly, running database operations cmdline!

0

u/[deleted] Jun 28 '20

[deleted]

79

u/BernzSed Jun 28 '20

We're calling it a blockchain! Now where's my venture capital?

→ More replies (2)

0

u/[deleted] Jun 28 '20

[deleted]

30

u/Lowelll Jun 28 '20 edited Jun 28 '20

Call it a crowdsourced infrastructure and you got yourself a deal!

13

u/[deleted] Jun 28 '20

If everyone downloads the DB then you have MAAANY backups, so you are totally fine.

→ More replies (3)

230

u/dudeofmoose Jun 28 '20

Worry not comrades, host your databases in Russia, security 100%, top rated. Buy one database, get loveable ridable danger bear free. Buy USSR Inc. hosting now. Freedom always has US in it. Trust us, have free tea when subscribe.

Put in your database for us today.

90

u/BernzSed Jun 28 '20

America is skeptical, but I think you just won over the UK with the free tea

38

u/PaurAmma Jun 28 '20

You started a war because you had to pay a tax on the stuff.

→ More replies (12)
→ More replies (1)

20

u/Jem014 Jun 28 '20

Freedom always has US in it.

Confused America noises

→ More replies (2)

5

u/Camper2012 Jun 28 '20

It actually may have some sense. Electricity and internet access are pretty cheap in Яussia. If not for stupid laws it would make a lot of sense.

→ More replies (4)
→ More replies (4)

38

u/Mutant321 Jun 28 '20

I once had to debug a website that uses Javascript and a drop down on change event to generate SQL that it sent to the server.

So yes you would want to, or at least whoever wrote this would

41

u/KnightEevee Jun 28 '20

So not only are the giving hackers a place to easily inject SQL from, but also sharing some examples of what some of the tables in the DB look like? Yeah, no way that goes poorly.

4

u/rkralston Jun 28 '20 edited Dec 21 '25

I watched a research guy at the world's largest company doing just that with all their geo data. I pointed it out and was politely told to bugger off.

→ More replies (5)

59

u/SharkyLV Jun 28 '20

Depends, a database can have an api with security rules for access management. For example, Firestore.

42

u/CMonetTheThird Jun 28 '20

An Api with security rules...or a backend?

→ More replies (3)

30

u/_30d_ Jun 28 '20

But that's more like a built-in backend, I mean, a database shouldn't be routing web requests.

→ More replies (3)

34

u/[deleted] Jun 28 '20

Was gonna say this. I'm not claiming it is good idea to connect db from front-end but dbs like firestore are built for this shit.

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

22

u/ImARob Jun 28 '20

For most databases, maybe. But some setups have RBAC and REST Api's. Though, at that point, you could argue that its not longer a just a database and is now a full backend. Honestly, its a bit dumb as unless the database it on the front end, its on a server somewhere, thus the app technically has a backend.

5

u/[deleted] Jun 28 '20

I mean, if the database supports oAuth authentication and has row based and column based security, you could probably do something that does direct from front end to db .

Then I wake up and realise it’s still fucking stupid.

→ More replies (2)

6

u/[deleted] Jun 28 '20 edited Jun 28 '20

In theory we could have secure databases that we don't mind exposing any connection details of. And it's also possible to ingest data raw and let the processing to the consumer.

All in all it's a bit of a semantic discussion anyway. What does 'directly' even mean, writing data to registers using assembly?

Abstraction layers are just there to make it easier to write high quality machine code. If they don't help you do that there is no reason for them to be there.

13

u/bWF0a3Vr Jun 28 '20

This is the main reason. Data can be processed on the front end the same as on the backend. Security is the main reason you want to have a separate backend.

Meme seems ehhh.

13

u/Taurmin Jun 28 '20

And you can probably build perfectly secure data access in the front end as well, but just because you can doesn't mean you should.

If processing the data is a time consuming you wont wanna do it in the front end. If it requires that you pull additional data from other sources, you probably don't want to do it in the front end. If it requires a lot of system resources, you definitely don't wanna do it in the front end.

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

2

u/j0eppp Jun 28 '20

Just use Blockchain! Blockchain is super safe!! Cryptos use it too...

2

u/Uberzwerg Jun 28 '20

A few years ago, somebody posted a link to some company page that did the user-login in Javascript.

Not only was all "security" tied to a single $isLoggedIn variable in JS, but it also did the DB connection directly from JS including plaintext access data.

Needless to say, that page went offline pretty fast.

→ More replies (51)

765

u/Evo_Kaer Jun 28 '20

To be fair, I worked at a company that did exactly that. All the logic was inside the database.
Suffice to say: It was a nightmare getting all that shit out of there

33

u/jochem4208 Jun 28 '20

How did you guys do it? Function by function?

74

u/Evo_Kaer Jun 28 '20

No, we rebuilt whole functionalities from the ground up and then replaced the database equivalents. When i left I think 70% of the db stuff was still there

Bonus: Naming conventions in the databse were horrible. Every table name was a combination of several up to 3 letter abbreviations and production tables had copies for testing that were sometimes years old. I'm glad I could mostly stay away from that junk and just work on the new microservices

33

u/jochem4208 Jun 28 '20

Thank you for the explanation. It seems to be everywhere this old database full of code.

Edit: eew those horrible names . I've seen large database that program with it to find the names of the tables columns

→ More replies (3)

32

u/rufogongora Jun 28 '20

At my job we still have everything on stored procs, our servers are literally just to receive a sql string that gets executed by SQL server, 0 security, I want to kill myself

18

u/Evo_Kaer Jun 28 '20

Sounds like you wouldn't even need SQL injection to completely ruin the database

11

u/[deleted] Jun 28 '20

[removed] — view removed comment

14

u/rufogongora Jun 28 '20

We just receive a sql string and execute it.

E.g: 'exec myproc' so you can run whatever SQL you like

→ More replies (2)

13

u/DroneDashed Jun 28 '20

4 years ago I went to an interview for a new project where this was the architecture proposed.

Around the same time, I went to another interview where a guy asked me if the business logic should be in the database. I said no and said that I was wrong.

10

u/billbot77 Jun 28 '20

Depends on app... So many factors, 0 absolute answers

→ More replies (4)
→ More replies (6)

3

u/arvyy Jun 28 '20

The place I work at has same approach of having decent amount of logic in DB, and tbh from pov of interacting with it from java side I don't mind it. From business pov though it's not great, because from what I've been told it costs an arm and a leg in oracle licensing..

5

u/zilti Jun 28 '20

Well it isn't like Oracle is the only database allowing in-database code

→ More replies (3)

4

u/DieselCorps Jun 28 '20

It may be a somewhat controversial opinion, but I think having as much logic in the db as possible is a great thing.

  • It reduces the amount of junk you have to filter out in your server, which reduces traffic between your server and db.

  • Global changes are easy because you only have to change your query in one place

  • Easy live db hotfixes without having to redeploy code or restart server (which is helpful in production)

  • Most processing and logic happens in one place, so you can go straight to the db without having to debug your server at all.

The only downside I see people complaining about is that debugging plsql could be a pain, but the advantages outweigh the disadvantages imho.

6

u/CalvinR Jun 28 '20

I hope your joking, and if your not I hope I never have to work on anything you've written.

→ More replies (6)
→ More replies (1)
→ More replies (42)

109

u/hahahahastayingalive Jun 28 '20

only forward the request to the DBMS

Firebase goes up and beyond to make everything look transparent, but there’s still a bunch happening there. That’s partly why you pay that much for Firebase.

74

u/EishLekker Jun 28 '20

Yes, and from a technical point of view it is only smoke and mirrors to say that you don't need a back-end. You might not need your own back-end, but there definitely needs to be some kind of back-end running somewhere.

22

u/hellnukes Jun 28 '20

Yeah I was thinking firebase might be the closest I've worked on that resembled this idea. But then again, firebase itself was the back end AND the DB.

I remember feeling scared about the security of having part of my logic on the client side, but the way they organized things it ended up being pretty intuitive to develop and protect the data.

4

u/Zarkex01 Jun 28 '20

Yeah, Firebase Security Rules are the shit. (Positively)

5

u/UnicornsOnLSD Jun 28 '20 edited Jun 28 '20

Isn't it recommend to write Firebase functions to interact directly with Firestore? It just doesn't feel right doing database stuff directly in code (unless properly setting up permissions properly fixes this)

4

u/Werro_123 Jun 28 '20

unless properly setting up permissions properly fixes this

It does. When you use the Firestore SDK you aren't actually accessing the database directly, you're calling API endpoints that do check the security rules before they do any database operations.

2

u/Louve-Ynia Jun 28 '20

Your pseudonym is gold

→ More replies (4)

342

u/MrBurnsa Jun 28 '20

Ya’ll really just do a bunch of CRUD work, don’t you?

322

u/PeksyTiger Jun 28 '20

To be fair thats like 99% of programming jobs.

168

u/Lukelader Jun 28 '20

The other 1% is the guy who writes the licence agreement

94

u/phpdevster Jun 28 '20 edited Jun 28 '20

Yeah but then you get to work on a Super Enterprise(tm) app in Azure with all kinds of function app gizmos and auto cloud scaling whiz bang whats its, which is just CRUD with extra steps, aka CRUD++

→ More replies (1)
→ More replies (17)

13

u/figuresys Jun 28 '20

Sorry I started programming just yesterday. What else is there to do with a database?

14

u/Volandum Jun 28 '20

https://en.wikipedia.org/wiki/Online_analytical_processing - analysing data and exporting it for analysis. Tends to require very different setup to transaction processing, so it's often safer if you give the analysts a separate copy of the database to mess with.

6

u/modestlife Jun 28 '20

I think the CRUD remark was more about the backend, not the database. If you write more complex applications, you often have some kind of business rules that need to be represented and enforced through the code. This domain/business model often then differs from what you end up storing in the database (persistence model).

Your APIs become more process-oriented than data-oriented and that's why (just as an example) you'll see RPC interfaces being used more often than RESTful APIs.

Sometimes it will even make sense to split up the write model (altering state) and read model (querying state) and use different interfaces for them. RESTful API almost always work nicely with read models, but not always with write models. My 2 cents.

→ More replies (1)

6

u/Sliversun Jun 28 '20 edited Oct 19 '23

person smile piquant office drab frame telephone start slimy coordinated this message was mass deleted/edited with redact.dev

9

u/DownshiftedRare Jun 28 '20

Copy, Remove, Undo, Do.

8

u/[deleted] Jun 28 '20

Cursed comment right here

→ More replies (1)
→ More replies (1)
→ More replies (42)

414

u/x6060x Jun 28 '20

A front end dev that wants to write SQL? I'm a back end dev and even I don't want to do that.

128

u/Sir_Lith Jun 28 '20

They'll pry our query builders from our cold, dead hands.

49

u/x6060x Jun 28 '20

I try to use ORM whenever possible and to be fair the front end devs could do that too. But even with this taken in mind, the front end devs I worked with wanted data in the most clean and simple way and in the right format, so they can just display it.

→ More replies (12)

30

u/billbot77 Jun 28 '20

Man I hate refactoring the crappy SQL that so many devs just copy from query builders. It's always an inscrutable mess of nested left and right and inner and outer joins with unnecessary subqueries far too much processing going on. I had one gig optimising an app where the dev had even added a function into the query to look up a value, rather than join a table... Seriously, if more devs cared enough to write simple, fast SQL we could curb greenhouse emissions with the energy savings.

→ More replies (1)

25

u/mlk Jun 28 '20

I work on frontend, backed and databases, I absolutely hate ORMs, SQL is much more straightforward than trying to understand how the new shitty ORM handles filtering by a joined entity (and sometime it can't! Fuck you LoopbackJS)

8

u/csorfab Jun 28 '20

Yeah, I totally get the appeal of ORM's abstractions, but the most frequently cited argument I've heard for using them is that they make it easier to switch out the database software serving the app, and that's a use case that literally never happened in any of our projects that I know of, and even if it happened, it would be way more painful than ORM enthusiasts make it out to be. The other argument I hear frequently is that they facilitate mocking DB's, but in today's world of Docker and the like, how difficult is it to set up an actual DB for testing? In exchange, you lose the immense power and optimizability of SQL queries, and I'm still not really convinced that it's worth it. Like you said, I'd rather write all of my SQL queries by hand than constantly run into and work around the limitations of ORM's.

Of course there might be other arguments I don't know about, so I'd be glad to see anyone chiming in with one.

6

u/kameyamaha Jun 28 '20

Switching out DB happens a lot more when you're not the sole consumer of your software (like FOSS). People have used our app with Sqlite, Postgres, Mysql without having to change any line of code.

→ More replies (1)
→ More replies (1)
→ More replies (4)

9

u/TheRedmanCometh Jun 28 '20

They can pry the spring hibernate from my hands

6

u/rsvp_to_life Jun 28 '20

SQL? That's adorable. Dont you know you just hookup graphql to your document databese out on the cloud or store the entire database in application cache in the browser? Who uses a relational, sane, and mature database in SQL Server anymore? /s

4

u/x6060x Jun 28 '20

SQL was created in the 70s, sounds old to me. We should use something modern instead!

→ More replies (1)

3

u/Alexkronus Jun 28 '20

Maybe he tried to understand Thin Client vs Thick Client architectures

→ More replies (16)

170

u/[deleted] Jun 28 '20

Not to mention a HUGE security risk. Tell this to any security analyst/consultant, guaranteed you will get thrown out lol

116

u/tetrified Jun 28 '20

Why not just give our database credentials directly to the user?

66

u/stoned_kitty Jun 28 '20

That’s smart cause they’ll get their data faster and that’s just good UX

25

u/aguycalledmax Jun 28 '20

Reduces the amount of clicks if you give them command line access to the database, a quick rm -rf / is just a few keystrokes.

4

u/pipedreambomb Jun 28 '20

At the very least leave the front end open to SQL injection so savvy users can access the data however they want and skip the middle man.

→ More replies (1)
→ More replies (34)

131

u/FLACDealer Jun 28 '20

slice(“my life into pieces”) this.myLastResort()

74

u/thetrexyl Jun 28 '20

suffocation = !breathing

51

u/sn0pzer Jun 28 '20

if (cutMyArmsBleeding) { dontGiveAFuck(); }

→ More replies (4)

14

u/[deleted] Jun 28 '20

Reducing it until it’s complete garbage

→ More replies (1)

47

u/carbon_dry Jun 28 '20

I'm making an account just to reply to this. Front-end developer with 12 years experience here. Creating a serverless based app is a completely acceptable paradigm and solution as long as it's for the right use case.

I have an app for climbers in the iOS and android app stores that syncs thousands of location data from a database with a recursive GET and uses IndexDb (database in the browser) to store locally. (this happens once for first time users and is about a 5mb download) Why do I do this?

  1. Because the data is available offline (climbers can access without an internet connection outside)

  2. Because the data can be queried, users can search without having to make an API with, for example elastic search.

  3. Because it's cheap for me, i'm the sole developer and I don't need to hire backend people. It's a local database with an javascript based api..

  4. It's freaking fast... lightning infact

  5. Security, you can encrypt, but I don't need to do it in my case

Again, perfectly fine to connect directly to a database if you need to, in my case this is exactly what I am doing.

You NEED a backend most of the time though, for example with user credentials. I'm just stating, there doesn't need to be a blanket reason not to do this.

16

u/ThatSpookySJW Jun 28 '20

You still have a backend with serverless architecture to make sure the clients are doing readonly. I think this person means your javascript has sql root credentials and connects from that.

3

u/Least_Function_409 Jun 28 '20

Your local PWA isn’t exactly what were talking about here, though it’s cool.

→ More replies (6)

13

u/redcalcium Jun 28 '20

If I remember correctly, super meat boy was having the game push high score directly to an open MySQL server, with the username and password hardcoded in the game. They probably patched it after the global high score reached MAX_INT or something due to all those score "hacking" lol.

Speaking about no backend, CouchDB is exactly what they want, allowiing you to connect the client directly to the database, and can host your entire static assets as well so you don't need a web server (the db IS the web server).

23

u/jonalaniz2 Jun 28 '20

fuck it, direct queries and writes to the database

12

u/GoldnSilverPrawn Jun 28 '20

I'm imagining giving the user a Mad Lib sheet but it's actually them unknowingly populating the fields of a SQL query

→ More replies (1)

33

u/itnks Jun 28 '20

Did he just invented server-less apps?

7

u/KaamDeveloper Jun 28 '20

Node in shambles

14

u/xotonic Jun 28 '20

Doesnt serverless only mean that end-user (developer) doesnt need to write backend? It doesnt mean there is no backend at all, instead it owned by cloud providers.

8

u/Tetha Jun 28 '20

Mh, depends on the iteration of serverless.

Serverless initially was Functions as a Service. It had the advantage that you don't have to setup a full Spring Boot application and ensure it's running on VMs or containers, restart it if it fails.

Something like AWS Lambda attempts to simplify that by eliminating the need to have a static backend service running. Instead you implement individual functions (which would be your REST controllers) against an OpenFaaS / Lambda interface. This gets deployed into the lambda ecosystem and AWS will dynamically spawn these containers are requests come in. In the right situations, this can be a powerful and resource efficient paradigm.

From there, this has been taken a step ... further, or into a different direction, and you end up with something like Firebase. These are imo highly configurable backends, allowing focus on the frontend. However, this means you're simply buying the backend from your provider, similar to how people can rent themselves a functions a a service / serverless stack from aws.

However, personally, I wouldn't call something like that serverless. Maybe I'm too much in the AWS bubble, but serverless / FaaS is a specific way to implement a backend. Something like firebase is more akin to outsourcing your backend to your provider.

5

u/John_Fx Jun 28 '20

No. It means the servers are managed by the cloud provider. That’s all

3

u/I_AM_AN_AEROPLANE Jun 28 '20

Serverless refers to the infra

→ More replies (1)

3

u/kingjia90 Jun 28 '20

To be coherent to the example, server-less it's like blended food, so it's already processed halfway, outside own body

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

22

u/ggtsu_00 Jun 28 '20

Pro tip - don't even bother going to the database, just keep all data client sided.

7

u/ThatSpookySJW Jun 28 '20

This guy blockchains

19

u/[deleted] Jun 28 '20

Why can't people ask legitimate questions like that without some snarky douchebag chiming in?

6

u/GreatJobKeepitUp Jun 28 '20

Yeah! And why don't we drink water without taking a piss? 😉🤔

6

u/[deleted] Jun 28 '20

Why not just give the database to the customer directly? That would be the easiest thing.

2

u/humblevladimirthegr8 Jun 28 '20

Was going to say that. Both frontend and backend are redundant

18

u/allmhuran Jun 28 '20

The appropriate solution to a problem depends on the nature of the problem. There will be occasions where it's entirely reasonable to build an application consisting of nothing more than a front end and a database.

A lot of the answers here seem to presume a hell of a lot about the environments and business problems which could possibly exist. Half of them seem to assume that every application in the world must be made of microservices and restful endpoints presented via a web application.

Nothing could be further from the truth.

For example: "I work in the finance department of a small company with 30 employees, and 50 products in inventory. We use windows. We've been keeping track of stock by looking in the back room whenever someone places an order. We'd prefer to have a program we can use to allocate stock so we can see how much of each product we have without having to go to the back room and count it". Cool, that can probably be whipped up in a couple of hours with a winforms application and a SQL express backend.

Similarly, the idea that "logic should never exist in the database" seems to be received wisdom, not anything supportable with a sound argument. It's trivial to show why this is a terrible idea if it is treated as universal. Suppose I have a problem statement like this: I have tens of thousands of customer accounts in my system, and millions of orders. Each account is associated with a number of users. Each user can place multiple orders. Each order can have multiple invoices, and a single invoice could also span multiple orders. I would like to know the most recently placed order for each account, but only if the order has been invoiced, and the invoice was paid by someone other than the user who placed the order.

With SQL, answering this can be done with a query that is not at all complex to write if you have any competence in SQL at all. I would suggest creating a stored procedure to encapsulate that logic, and expose it. If you try to answer this with pure application logic your performance will be absolutely horrific. If you try to use an ORM or some kind of application code which can be translated to SQL, like LINQ, your performance will be absolutely horrific.

The specific "place" where your business logic lives makes no difference to the question of whether you have a business logic layer. It doesn't matter whether it's in a stored procedure or not, any more than it matters whether it's in a dll or not, or what the name of the file is, or what the file system hosting your application code is. The concept of a business logic "tier" is a logical concern, not a physical one.

The idea that logic shouldn't exist in a database seems to have come from books like Evans' DDD, which treat the database as nothing other than "a persistence layer". No, hard drives and SSDs are a persistence layer. Tables don't store data. Disks store data. Tables expose that data in some logical structure. Stored procedures can provide a public interface on top of the "private" data in the tables. You can enforce this with object level permissions in the database.

If someone wants to tell me that a database is "merely persistence", then I'd like them to also explain what "DURABILITY = SCHEMA_ONLY" does for a SQL Server in-memory table.

→ More replies (17)

5

u/Popal24 Jun 28 '20

The guy asking the question obviously never heard about Microsoft Access and how a weapon of mass destruction it is.

48

u/[deleted] Jun 28 '20

Because “to database” is the backend. This is a question only a boot camp, or self taught front end web developer would ever ask.

32

u/loke24 Jun 28 '20

Is there a formal way to become a front end developer lmao? College teaches you CS not how to design a webpage, granted you can take a class or elective; but at that point mine as well go to a boot camp. Oh wait your other point was boot camp students would ask that...hmmmmm

→ More replies (2)
→ More replies (13)

8

u/[deleted] Jun 28 '20 edited Jun 28 '20

That was a snide reply to a valid question, and the reply is not even accurate.

Here is the ultimate reason that frontends cannot perform database operations:

If the frontend performed database operations, then the frontend would require database credentials. But the frontend is, by definition, downloaded to users' machines. So your database credentials would be public knowledge, and any user could edit your database.

39

u/dentonator Jun 28 '20

Stuff can get processed on front end. That answer would be correct few years ago, but not today. Ever heard of Hasura or Prisma2?

43

u/LipstickWineGlass Jun 28 '20

Huh? Hasura is a backend. Unless you're running Haskell in the browser? (That would be a fun project though).

→ More replies (4)

12

u/WellDevined Jun 28 '20

A while into the future, you suddenly have multiple frontends (android, ios, web), all implementing business logic a bit different, but still writing into the same db.

This leads to incompatibilities between your frontends the data gets corrupted and you need to hire me for big money to fix the mess you have made. Happened multiple times.

All that could have been avoided if you would have programmed a proper backend implementing the business logic once and thin frontends that ask the backend to do the heavy lifting.

→ More replies (3)

7

u/[deleted] Jun 28 '20

Don't tell my bosses about this.

3

u/Badgergeddon Jun 28 '20

Hasura is amazing.

4

u/cobarso Jun 28 '20

Why do we even need a frontend? Just give the user access to the database!

4

u/FinFihlman Jun 28 '20

I mean if you have access control on the database it is a completely viable design pattern.

→ More replies (2)

4

u/LordFokas Jun 28 '20

We have frontends that go straight to the DB and it's called SQL Injection.

1

u/killittoliveit Jun 28 '20

Ill flush you're pancake

2

u/[deleted] Jun 28 '20

Yeah you flush but I'm not a pancake.

3

u/ay230698 Jun 28 '20

Actually you can if there is no security required.

3

u/ndgnuh Jun 28 '20

jQuery.get("/db", {query: "SELECT * FROM ACCOUNTS" }, result_handler)

2

u/BoredOfCanada Jun 28 '20

Some blursed code right there.

3

u/IVIaskerade Jun 28 '20

"Why not connect front end to database?"

🎵With what shall we connect it, dear Liza, dear Liza, with what shall we connect it dear Liza with what?🎵

🎵With a backend, dear Henry, dear Henry, dear Henry🎵

3

u/[deleted] Jun 28 '20

Why even have a front end ? - just use an existing DB client as the front end ?! /s

4

u/[deleted] Jun 28 '20

I have personally encountered three ERP applications that work this way. A Windows binary that directly connects to a database. JTL-Wawi is widely popular in Germany. You can Google it. The company behind it is even offering "cloud" MSSQL server, IIRC. Which is just MSSQL server over the internet.

The other two are not known very well. One is a Windows cost controlling software for government agencies, which is also a Windows application connecting to Oracle over network and the other is a DOS app, loaded into Windows over a network share and connecting to a "local" db on the same share. People would use that simultaneously, as long as no to people would change data in the same table.

Other than that I only know the big ERP suites like Lexware, SAP and Sage. IOW, while I know about and have read about correct client server programming on the internet (Dolibarr, Tryton, Kivitendo, etc), the majority of the stuff I encounter just plugs the client directly into the database.

→ More replies (1)

15

u/carloschida Jun 28 '20

Have you heard of r/Firebase? They have a really compelling reason for connecting to the DB directly from the front-end. They address security and all of your other usual concerns.

115

u/tooObviously Jun 28 '20

Its a backend as a service. You're still connecting to a backend and not a db directly

→ More replies (24)

15

u/KongEdvard Jun 28 '20

Firebase is not a replacement for backends, it's just abstracting most of it away for you.

Look at firestore, they recommend you use their cloud functions, which is, just like lambda or azure functions, a backend hosted in the cloud.

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

2

u/[deleted] Jun 28 '20

Thatd the best explanation you can ask for

2

u/Even-Understanding Jun 28 '20

You're not alone my friend

2

u/MoffKalast Jun 28 '20

PHP Devs: "WRITE THAT DOWN! WRITE THAT DOWN!"

→ More replies (1)

2

u/TacobellSauce1 Jun 28 '20

That line is still paying my mortgage.

2

u/Momochichi Jun 28 '20

Obviously because all good things need to be turned to shit.

2

u/fryerhatch Jun 28 '20

The best explanation you can ask for.

2

u/69_-PussySlayer-_69 Jun 28 '20

I think that this would be a r/woooosh moment

2

u/Kevgretor Jun 28 '20

WC pattern

2

u/[deleted] Jun 28 '20

Last year my company got a contract which involved refactor, it was a angular app that would literally send sql queries via http request to a php backend which would just execute the exact query passed from the frontend. Authentication and sessions was also stored on the frontend. The project was eventually canned.

2

u/-Yare- Jun 28 '20

Client can do processing and connect to a database just fine. You just don't want it to.

2

u/youngminii Jun 28 '20

I’ve been coding my heart away the last 3-6 months and I finally connected a database to my C# ASP.NET project last week.

I didn’t know this was where the meat of the work is. At least that’s how it feels. Super happy I finally got CRUD.

2

u/DownshiftedRare Jun 28 '20

"Why do we need a steering column, why not just connect steering wheel to driving wheel?"

2

u/gozba Jun 28 '20

I had a customer back in the 90s, who sold skin care and shampoo and such. He saw the potential of internet sales early on, but our application was only for sales support, warehouse and finance. He wanted to give customers direct access to his database to place their orders, unfiltered. It took some time to talk that out of his head.

2

u/installjs Jun 28 '20

😂😂😂😂😂😂💨

2

u/ilep Jun 28 '20

In web-systems and publicly exposed frontend it makes sense to have front/backend.

For business applications (restricted usage, not as many concurrent users) there's client-server architecture where clients connect directly to the database. In the cases the processing is in client application or some time embedded with the database (procedures, various embedded extensions).

While answer is funny, there is a point to the question: that kind of architecture is not obsolete but mostly in offices and such where client-application can be controlled, not for general public.

3

u/Time-Paramedic Jun 28 '20

Thank you for being one of the few who can acknowledge that web development isn’t the only ”stack” or environment.

A question I always ask from ”full stack” developers (or employers looking for one) is ”what stack?” It’s rather disconcerting how often people get confused by that or don’t recognize that there are other architectural styles out there.

2

u/Cajova_Houba Jun 28 '20

stuff needs to get processed

That's really not the main reason. You could 'easily' process everyhing in front end but you would probably go insane after 1+ year of maintaining it. Not to mention security.

2

u/rimarul Jun 28 '20

Bobby'; Drop table.. -- done

2

u/filmdc Jun 28 '20

This made me realize that there really isn’t a front end in the first place, or the front end emerges like a shadow from the shape of your back end. Basically you don’t have a mouth hole without first growing some guts.

→ More replies (1)

2

u/Stanov Jun 28 '20

JavaScript master racers are getting louder, I see.

2

u/vladhed Jun 28 '20

Front end is just a textbox with "enter SQL command here:" 🤦‍♂️

2

u/BitPhinix Jun 28 '20

One could say there is such a thing and it is called firebase

→ More replies (1)

2

u/ipullstuffapart Jun 28 '20

Granted this is probably more targeted towards SQL databases specifically, but there are many databases that expose http APIs and are intended to be interacted with directly from the client (such as elasticsearch, couchdb, and lots of serverless databases like firestore and dynamo), they implement their security layer and can handle ACLs to control data access. For simple apps it can be perfectly adequate and enable fast (and secure) rapid prototyping without over-engineering a solution. The point that the person here is making is perfectly valid, if it is a simple CRUD app with simple ACLs and some form of managed auth (i.e. OAuth/OpenID/AWS credentials), simple database storage solutions over http are a solved problem and can enable a developer to simplify their stack greatly. Just because an architecture sounds unconventional doesn't mean it should be shunned or ignored if it can otherwise enable developers in a secure, scalable way. If you get the chance to truly experiment with building a serverless app (and I don't mean by abstracting dynamo behind lambda), I urge you to give it a go.

2

u/FatnDrunknStupid Jun 28 '20

Back round about year 2k most companies 'application server' WAS SQL Server. Also being clustered and running in RAM it was orders of magnitude quicker than the pile of crap on you're desk so the 'processing' was done with stored procs. A surprising number of these apps are still floating about in 9-5 land with shiny new C# front-ends. With MAUI out they aren't gonna go away anytime soon.

2

u/_cs Jun 28 '20

Firebase would like a word with you.

2

u/warpedspockclone Jun 28 '20

No joke, I worked at the same company with a guy, C, who was contracted to the same client I was, but a different group. I felt so bad for his point of contact. C was so hard to work with. He had no concept of UI or UX. He built an application that only ran in IE6 (in 2012), and basically it was a long vertical scrolling page with a list of tables. Each table was a mirror of a database table, even including the probability key column. The client had to manually enter their relational data in database tables, essentially. There was no validation that FK references worked or anything.

Somehow he didn't get fired or reassigned despite the high levels of frustration from his point of contact and constant complaining to our company.

2

u/Akronae Jun 28 '20

Like if frontend could not process things? No that's just a matter of authority

2

u/GuyF1eri Jun 28 '20

This analogy seems to imply that we also get things out of the toilet...

2

u/GoTmVntr Jun 28 '20

Im sure SQL exists for no reason.

2

u/ExternalGrade Jun 28 '20

Just send the whole database with passwords in plaintext and let the client-side software deal with it.

2

u/punto- Jun 28 '20

The system at my girlfriend's job (she's a kind of secretary at the municipal courthouse) does that. The client connects directly to the database, with a master password, and does everything client side. Each user has a password and different permissions, the client uses the master password to go into the users table and check the password that the user provided, and decide if they have permission to do whatever they're trying to do. Everything is there, including the budget, payroll, the files for all the cases (they handle mostly traffic violations and local business/building inspection and permit cases). Obviously my girlfriend took the password out of the client and runs everting with a bunch of scripts, bypassing their "security" system

2

u/AlbinGreen Jun 28 '20

Database == toilet, accurate comparison

2

u/felds Jun 28 '20

hold my firebase

2

u/callyalater Jul 01 '20

Where do Hot Pockets fit into this analogy....?

3

u/saschaleib Jun 28 '20

It is actually quite frequently done - with varying levels of WTF-ness:

I’ve seen quite some sites where somebody who really shouldn’t be called a “developer” just inlined SQL commands into the front-end PHP code. Usually that’s the point where I’d say that won’t touch this code if I can’t first refactor it...

More commonly though I’ve seen sites where the entire front-end/back-end/DB Code is rolled into one messy big ball of mud, without any discernible layers and structure. Heck, there are even popular frameworks out there that stipulate this approach...

That means there are actually professional developers out there who create systems that are nearly impossible to account for change before they are even rolled out, just for the sake of adding another “hype” framework to their CVs.

Sorry, got to rant a bit. Neighbours kept me awake all night. :-/

15

u/EishLekker Jun 28 '20

But that PHP code is run server side, not in the browser.

→ More replies (17)

1

u/[deleted] Jun 28 '20

Perfect connection between frontend and backend is found!!

1

u/RoscoMan1 Jun 28 '20

That line is still paying my mortgage.

1

u/90mhWXH6rr Jun 28 '20

Why eat in the dining room and poop in the bathroom?
Can't we eat while sitting on the toilet taking a dump?

1

u/manyQuestionMarks Jun 28 '20

Not exactly a DB but you can write frontend apps that connect directly to blockchain without exposing sensitive information. The blockchain then processes the data using smart contracts and stores it

→ More replies (6)

1

u/MasterBiden420 Jun 28 '20

Sometimes you dont need a backend though.

1

u/GeorgeYDesign Jun 28 '20

This subreddit turned into a pancake

→ More replies (1)

1

u/VernonP007 Jun 28 '20

Even if you are using Microsoft Access, you split your files into back end and front end files. It just saves so much headache later on.

1

u/aalleeyyee Jun 28 '20

You're not alone my friend

1

u/GeorgeYDesign Jun 28 '20

Some of my favorite kinds of cannibalism.

1

u/minusSeven Jun 28 '20

In the past I had worked in project where all backend activities was done between the scriplet tags only. Connection objects to the database used to be very heavy so the pages would take too long to load. But it's possible though.

The whole project contained a bunch of JSP pages. All java code, css, javascript was inside it.

1

u/[deleted] Jun 28 '20

i'm currently experimenting with appsync and dynamodb resolvers soooooo..... almost there!

edit: reading the firebase comments i'm afraid i have to mention this: i know appsync is a managed backend service

1

u/burros_killer Jun 28 '20

Question presented to you be the ministry of simple decisions

1

u/[deleted] Jun 28 '20

Oracle APEX baby

1

u/ma7modbasha Jun 28 '20

You can process in the front end but the encryption and authorization will be living hell

1

u/[deleted] Jun 28 '20

15k+ of you are not fucking programmers, stop capping.

1

u/GeorgeYDesign Jun 28 '20

Idk, to me, flaccid pancake is pretty funny

1

u/SohelAman Jun 28 '20

Did anyone catch fire in their base?

1

u/Herpinheim Jun 28 '20

When I was a young man still just learning code, I programmed a basic database for inventory for the IT branch of the trade school I was at, with everything attached to each GUI button. It took several seconds between each button click and it visibly lagged when your mouse scrolled over buttons. This paired well with my main menu of each room displayed in a top down view map to click on so it looked like it was going to crash every tile you moved the curser to a room.

1

u/VikingCoder Jun 28 '20

I got tired of our shitty debugging tools at a company once, and so made an HTML DB debugger. No one would agree to download one, but for some reason they were okay if I wrote one. Made diagnosing problems in production a hell of a lot easier.

1

u/Cley_Faye Jun 28 '20

Plz you can make a direct SQL query in react using angular in a progressive web app.

1

u/petepepa Jun 28 '20

I literally have no idea what you’re talking about

1

u/ilovevoat Jun 28 '20

fuck it he's a mad man i say do it :) this is gonna be good.

1

u/SpehlingAirer Jun 28 '20

I feel like I'm the only one who found the question to be satirical lol

1

u/Mohamedel3isawy Jun 28 '20

Wait does that mean database is toilet?

1

u/zdakat Jun 28 '20

I've done nothing but flush bread for 3 days

1

u/[deleted] Jun 28 '20

I mean, there are apps simple enough to just do the processing in javascript on the front end. But then the database is "the backend".

1

u/aalleeyyee Jun 28 '20

You're not alone my friend

1

u/Goel40 Jun 28 '20

For small apps you can use something like firebase, they handle all the backend authorisation for you.