As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have a Rails app with 600 models and that will soon grow to 800-1000. I'd like to segment the rails app so that only certain models get loaded and therefore act as a separate app, but all share the same base models. Is there a standard practice for doing this?
EDIT: I am on 2.3.8
EDIT 2:
The problem is that many models are similar, but different just enough that it warrants writing a new class, i.e. the logic required to put it all in one model would be horrendous. Some of the models could be moved out into rake tasks or the lib directory, but only about 30 or so. Some are abstract classes that act as parents of one arm of the model tree. However, most relate to database tables. I am thinking about at deploy time segmenting parts of the app into plugins via Engines so that one app can only handle one set of models (they are independent) but so that I can keep them all together in development and in one git repo for convenience. I"m going to go down this route unless someone else has a better idea, and I'll post back to let you know how it goes.
Dude, thats a pretty insane amount of models... anyways for handling complex logic and easily reuse them across other projects I would recommend to you the engines (from 2.3+ is part of Rails).
With that in place you can split your model in different modules (engines)
http://railscasts.com/episodes/149-rails-engines
Toño
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm researching a project that involves displaying different data on different monitors. Essentially it is a like a game show app. The idea is a teacher plugs his/her laptop into a projector and starts the application. The projector displays the question with a countdown timer. The laptop screen shows the question & countdown timer but also shows the answer to the question as well as a list of students so the teacher can select the one that got the answer right so it can keep score.
I think it would be fairly straightforward as a window forms application but I'd like to make it web-based so that we don't have to worry about the specs of the teachers' machines being compatible, distributing updates to the various teachers, etc.
It looks like Silverlight may be a possible solution based on this post, but I was wondering if there were any other options for this. Also, since I'm in the research phase, I'm pretty flexible about looking at different options.
You could get something working with ASP.Net by having two different pages, one for the laptop screen, the other for the projector, and have the two pages talk to the server via SignalR.
The teacher would need to manually move the pages to the right monitor, though.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What's a good conventional order for associations, scopes, attributes, validations, callbacks, non-standard code (acts_as_*), class and instance methods?
Also, if I need to split a model into modules, is it better to base these modules on features (Post::Comments, Post::Share, Post::Admin etc.) where each module also include the scopes and associations, or is it preferable to keep all scopes and associations in the base model and only split the methods?
You won't get a clear answer on this. It depends on your personal preference and what suits your code.
What I would suggest regarding the order in the model: pick one, and stick to it. It doesn't really matter if callbacks come before or after validations, as long as it makes some sense to you, and you can remember it.
And about the modules: I would pick two of the smaller models, and try both approaches and have a look what suits you better. Personally I don't like my scopes distributed amongst multiple files, but that does not have to be your preference too.
Maybe you want to have a look how others are doing it, e.g. https://github.com/gitlabhq/gitlabhq or https://github.com/diaspora/diaspora to help with your decisions.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
When building an MVC application from scratch without a pre-existing database, is using the code-first approach the best way to do it?
While most applications are database-centric, it is perhaps the schema rather than the database itself that governs how the app is built around it. As such, I think a code-first approach isn't too bad. It was late to the party (happened after database-first and model-first), but I think the code-first approach will become the norm soon.
What's your opinion?
First i think that this link can provide you with more information
In my opinion both of the approaches are useful. A developer/company needs to decide what is the best approach for there system, in some situation.
I think one good distinguish is Big and complex against small and simple applications
I think that developers or companies will prefer "DataBase First" approach when they builds complex application. In most cases DBA's will be needed in such project.
In those cases the project will include Store Procedures/ Triggers and maybe also a Data-ware house
In the other hand when you build a small application with one of small group of developers you probably prefer using "Code First" approach
again this is my opinion...
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
It's been shown that Ruby On Rails isn't especially fast in a performance perspective. Even PHP may be faster, but obviously there's other things that adds up to the cons of Ruby On Rails. Development speed is among those and commonly mentioned by people as one of ROR's biggest strengths.
However I have not seen any objective opinions on this. Does Ruby On Rails really help to keep development speeds lower than other web application programming languages?
This is a very controversial subject (in fact, I expect this to get closed!).
I would argue that RoR can deliver faster development, but only if you're doing it right. The fact that it's so opinionated about some of the common tasks that come up during most development encourages you to do it right... it makes testing easier, for example, and virtually forces you to keep view logic separate from models.
And that said, performance wise, Rails 3 isn't exactly slow! In fact, I've found it (in my own, completely unscientific experiments) to perform better than Zend Framework for PHP.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Any thoughts/comments on a database with over 3,000 stored procedures querying/accessing over 1,400 tables (overly normalized). Really want to use technologies such as Entity Framework, preferrably 4.0, and get the business logic out of those sproc's?
Appreciate any real-life practical experience & feedback if you decide to share. This is a database I inherited and really feel like it's time to ditch the sproc's for a better business layer.
Not really an answer to your question, but you can still use sprocs in Entity Framework: see here, basically sprocs map to method calls on your context object.
My personal experience is actually the opposite to yours though: I've usually tried to stay away from EF because it has this tendency to become so tightly coupled with your application. The nice thing about sprocs is that they allow a degree of de-coupling (e.g. I can update the database without modifying client code). But that's just my personal opinion of course.
This depends on the shop you work at. I've worked at many shops that have conflicting strong opinions about whether or not to capitalize on sprocs, or code in the application layer. The question is: do you have more people that are expert at maintaining plsql/tsql or not?
Personally I used to hate sprocs, and favored orm tools, etc. Now days I prefer to keep the application code clean. This is only after getting really comfortable in the database. Let the database code exist in it's native environment, with all of the tools available to it.
Why use Stored Procedures?
In practice, you'll end up refactoring away from EF in a few years whereas your stored procs could still be sitting there ready to use in the latest and greatest client layer. Client agnostic, encapsulating, etc.