|
yeah. always use stored procs. and thats not sql server specific, but you should be using sql server.
|
# ? Mar 24, 2014 14:59 |
|
|
# ? May 28, 2024 16:20 |
|
St Evan Echoes posted:shaggar did I read you saying it's better to set up all your queries on sql server as stored procedures and then just exec from your app? statement mapping is the same idea but on the client side. you pre-write all of your queries and stuff them in objects, then call them with parameters. if you set it up right, you get sane return values back instead of dumb strings this has most of the downsides of stored procedures but it becomes much easier to do version control
|
# ? Mar 24, 2014 15:00 |
|
Shaggar posted:yeah. always use stored procs. and thats not sql server specific, but you should be using sql server. lol
|
# ? Mar 24, 2014 15:00 |
|
stored procs don't have downsides, only upsides. if you're using orms its cause your data doesn't matter
|
# ? Mar 24, 2014 15:00 |
|
per-app views and stored procedures are pretty great if you have lots of apps talking to the same database and you work in enterprise java hell for the rest of us, where often a single app uses the DB, there's no reason to put up with the hassle and lovely version control
|
# ? Mar 24, 2014 15:01 |
|
if you have more than 1 application touching your db, not using procs is a recipe for disaster.
|
# ? Mar 24, 2014 15:02 |
|
Shaggar posted:if you have more than 1 application touching your db, not using procs is a recipe for disaster. i agree completely but i don't plan apps around that idea. i don't work in an environment where that is likely to come to pass. serialising to sql gives me an "out" if i need one later, it's not super important in the here and now.
|
# ? Mar 24, 2014 15:03 |
|
Shaggar posted:all logic belongs in the controller. if you have logic in the model then it can have effects on the controller and view and you don't want that. you want the model to just be dumb data that you pass around. it can have metadata (annotations/attributes) for validation and stuff, but not logic. microsoft mvc tutorial disagrees quote:Models. Model objects are the parts of the application that implement the logic for the application s data domain. Often, model objects retrieve and store model state in a database. For example, a Product object might retrieve information from a database, operate on it, and then write updated information back to a Products table in SQL Server. quote:Controllers. Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. For example, the controller handles query-string values, and passes these values to the model, which in turn queries the database by using the values. i might be misunderstanding though
|
# ? Mar 24, 2014 15:03 |
|
it would be nice if databases really were flexible enough that you could throw whatever at them and believe that it would work out, but it just isn't the case; whether sprocs is good design (and release practice) is debatable, but that they are the safe and efficient way to go is not
|
# ? Mar 24, 2014 15:07 |
|
they're talking about using entity framework as an orm (don't ever do this) in which case all your objects inherit from entity or whatever so they have these methods for saving themselves and updating themselves. its all very gross, but technically the logic is still outside the model its just called from the base methods of Entity. (iirc) in all of their examples the actual logic of what to get from the database is done in the controller and then ef generates the sql to do the work. Since ef is outside the model and the logic it uses to generate the sql comes from your code in the controller I would consider it part of the controller, not the model.
|
# ? Mar 24, 2014 15:09 |
|
Cybernetic Vermin posted:it would be nice if databases really were flexible enough that you could throw whatever at them and believe that it would work out, but it just isn't the case; whether sprocs is good design (and release practice) is debatable, but that they are the safe and efficient way to go is not I don't think you know what a stored proc is. they're far more efficient and far safer than direct queries. direct queries are the least safe and least efficient possible way to access data from an application.
|
# ? Mar 24, 2014 15:11 |
|
pointsofdata posted:microsoft mvc tutorial disagrees traditionally, your business logic goes in the model. shaggar asserts that you should defy tradition and adapt mvc to the needs of enterprise software development
|
# ? Mar 24, 2014 15:27 |
|
Shaggar posted:I don't think you know what a stored proc is. they're far more efficient and far safer than direct queries. direct queries are the least safe and least efficient possible way to access data from an application. i'll get right back to you as soon as i start prioritizing safety or efficiency over development time or readability
|
# ? Mar 24, 2014 15:27 |
|
safety and efficiency are important to data integrity which is how your business makes money.
|
# ? Mar 24, 2014 15:29 |
|
Notorious b.s.d. posted:traditionally, your business logic goes in the model. shaggar asserts that you should defy tradition and adapt mvc to the needs of enterprise software development i've only ever seen business logic in the model of bad applications
|
# ? Mar 24, 2014 15:30 |
|
Shaggar posted:I don't think you know what a stored proc is. they're far more efficient and far safer than direct queries. direct queries are the least safe and least efficient possible way to access data from an application. i am perplexed how you managed to misread that post quite this badly
|
# ? Mar 24, 2014 15:36 |
|
oh I thought you were saying they were not safe and efficient. ok.
|
# ? Mar 24, 2014 15:40 |
|
Shaggar posted:safety and efficiency are important to data integrity which is how your business makes money. in a database accessed by a single application, stored procs have no impact on data integrity efficiency almost never matters to anyone, ever. they say it matters, but in reality they'd rather have the application on time
|
# ? Mar 24, 2014 16:14 |
|
stored procs really aren't much of a development cost when compared to the amount of garbage you have to do w/ an orm.
|
# ? Mar 24, 2014 16:20 |
|
especially entity framework. god that thing is bad.
|
# ? Mar 24, 2014 16:21 |
|
Shaggar posted:With MVC anything is possible if it is possible within the realm of web.
|
# ? Mar 24, 2014 16:23 |
|
A COMPUTER GUY posted:no fat models
|
# ? Mar 24, 2014 16:24 |
|
i have a single app touching multiple DBs...what sort of procs should i be using for that?
|
# ? Mar 24, 2014 18:32 |
|
USSMICHELLEBACHMAN posted:i have a single app touching multiple DBs...what sort of procs should i be using for that? multiple databases on the same database server, or are they all over the place? i know you can do cross-db stuff in sql server if they're both hosted on the same server instance (terminology may be incorrect)
|
# ? Mar 24, 2014 18:34 |
|
same server. one is mongoDB and the other is pgSQL
|
# ? Mar 24, 2014 18:34 |
|
USSMICHELLEBACHMAN posted:same server. one is mongoDB and the other is pgSQL okay, different db engines. can you even have stored procedures in mongo?
|
# ? Mar 24, 2014 18:35 |
|
that's a good question. i dont really know
|
# ? Mar 24, 2014 18:39 |
|
It probably works, I say just go for it.
|
# ? Mar 24, 2014 18:42 |
|
if they had both been sql server, a single query/sp could have touched both databases
|
# ? Mar 24, 2014 19:11 |
|
mongodb sucks and i will bet if you trace its origins in your workplace it will lead you to someone with a very punchable face (its u)
|
# ? Mar 24, 2014 19:13 |
|
hey CODERS -yeah? are your sql db queries SLOW? -no, not really. Yeah? Then you should try MongoDB its totally radical and saves multiple copies of ur data and- -shut up go away
|
# ? Mar 24, 2014 19:15 |
|
just put all your raw queries in a single file/folder/object/whatever and don't use ORMs.code:
|
# ? Mar 24, 2014 19:20 |
|
USSMICHELLEBACHMAN posted:i have a single app touching multiple DBs...what sort of procs should i be using for that? whatever procedure replaces them w/ a single sql server
|
# ? Mar 24, 2014 20:29 |
|
Shaggar posted:they're talking about using entity framework as an orm (don't ever do this) in which case all your objects inherit from entity or whatever so they have these methods for saving themselves and updating themselves. its all very gross, but technically the logic is still outside the model its just called from the base methods of Entity. (iirc) Blinkz0rz posted:fat dtos between skinny models and skinny viewmodels
|
# ? Mar 24, 2014 20:57 |
|
USSMICHELLEBACHMAN posted:i have a single app touching multiple DBs...what sort of procs should i be using for that? Setup linked servers.
|
# ? Mar 24, 2014 21:12 |
|
lol if your application doesn't use use oracle, teradata, hive/hadoop, and multiple local databases just for caching. lol if you don't have teams of data janitors QAing and normalizing everything so the data you consume is like 3 layers removed from raw
|
# ? Mar 24, 2014 21:22 |
|
Notorious b.s.d. posted:per-app views and stored procedures are pretty great if you have lots of apps talking to the same database and you work in enterprise java hell lmao gtfo bsd orms suck for many many reasons if u dont give a poo poo about your data, use an orm
|
# ? Mar 24, 2014 21:23 |
|
kraftwerk singles posted:lol if your application doesn't use use oracle, teradata, hive/hadoop, and multiple local databases just for caching. lol if you don't have teams of data janitors QAing and normalizing everything so the data you consume is like 3 layers removed from raw
|
# ? Mar 24, 2014 21:24 |
https://gist.github.com/munificent/9749671 you'll know it when you see it
|
|
# ? Mar 25, 2014 01:59 |
|
|
# ? May 28, 2024 16:20 |
|
i don't understand this:Malcolm XML posted:if u dont give a poo poo about your data, use an orm how does using an orm negatively impact data integrity? maybe you're just doing poo poo wrong (or have only seen it done wrong) and making snap judgements about it?
|
# ? Mar 25, 2014 02:13 |