SailsJS - Many to Many relationship - orm

I've gone through the documentation a few times and am not certain on how to approach this inside Sails so looking for assistance.
I have Programmer, Project, and Feedback.
I want to link them so that Feedback can be submitted for a Programmer for a specific Project. (e.g. "He was great!")
What is the best way to achieve this?

Project and Programmer have a many-to-many relationship. Programmer has a one-to-many relationship to Feedback.
Project has a one-to-many relationship to Feedback.
Just put them in all the 3 models following the direction/order like stated above.

Related

Should review of merge request include review of code style?

On the project (scrum with java, kotlin) we don't have any code style convention - so every team leader ask write code in for-a-bit other manner.
I work in the company on several projects -
as a result, every my merge request on different team's project has a lot of issues about code style.
What i can do in such situation?
You should escalate problem (cause it sounds real and objectively exists) - the decision can be creating such code convention.
Not for all company, maybe, but for your department or several teams with identical tech stack.

Projects to practice class inheritance and OOP

I am wondering if there are any good small/medium sized programs that I or others could make that would be good for practicing OOP or using inheritance in. I haven't seen any questions asked like this, so I figure it would be a good question for others to use in the future as well.
A project I have done already:
Inventory Manager: Controls the inventory of a shop and assigns the item type, price, etc. All of which you use inheritance to sort out products
The problem with this is that it can only go so far into the practice.
Any other ideas for projects that you have used to further your knowledge of the subject?
Thanks in advance!
A simple photo editor that lets you apply filters such as blur, sharpen or emboss can make a good example of using the command pattern. It's interesting to find the best way to implement the undo/redo feature. The memento may come in handy!
When designing the application structure keep in mind that later you will want to add new filters/effects. Then try adding them! If you're saving the image to a jpg, try adding a "save to png" feature. What if later you decide to support another format? Is your application easily extensible? Leave it be for a couple weeks and come back to it later. Can you still easily add a new effect or a new export format? Try it out!
A automobile dealership or rental car agency makes a good OO modeling problem. As far as inheritance, there are different kinds of vehicles and different kinds of contracts (sale, lease, loaner).

REST resources from database tables

REST resources from database tables
I have recently learnt things about REST (many of them i partially understood). I also made some simple demos which are not very restful but atleast i have tried somethings of REST. But when it came to developing some real world applications starting from the scratch I am cluless.
My problem is
I have absolutely no idea, when a bunch of tables are given
how to start desigining uris out of them ?
how to decide what are the resources ...?
Can every table be a resource...?
how to tackle with one to many, many to many relations among those tables..?
All the questions above are confusing for me. Basically where to start with uri designing when a bunch of tables are thrown at your face for REST uri design! I know URI designing is not the only part that makes it REST API but still it is important one..
This question is a continuation to this one I posted earlier on SO
How to decide a resource in a restful way based on some tables
Please dont say that there is no such prescribed standard. There should be one :| . I am asking only for a way ..just some direction where to start in designin uri's from db tables
Read A Brief Introduction to REST.
This is a great REST tutorial. It has the REST architecture design and many samples.

Rating system for multiple models in Application

I need suggestion for rating system implementation. I have Blogs, Discussions, Comments in my system, so each member can make +1 to current blog post or discussion entry, comment etc. I know that there is acts_as_ratable, but this is no what I need.
Any suggestions, what can I use to keep my code DRY?
P.S - I know it can be handled using polymorphic associations, but I'm searching for basic solution to integrate.
Thanks in advance!
This is a perfect case for Rails' polymorphic associations -- several different types are "ratable".
Good doc on this here:
http://guides.rubyonrails.org/association_basics.html#polymorphic-associations
And great screencast here:
http://railscasts.com/episodes/154-polymorphic-association

OOD / OOP Etudes / Code exercises

I've been searching the web for some time now. I am looking for small sample exercises for OOD practice (& for some internal TDD workshops).
If there is one single place, where this need is being served, please point me to it.. and close this question
Constraints:
Language-agnostic real world problem
Small : Something that takes an hour to two at max to solve (or has sub-parts that can fit this constraint).
Not Algorithm centred : Not be focussed on just solving a computational task. (There are multiple sites that serve this category.) Involve > 2 interacting entities.
Solved by multiple people, preferably yourself : Goodness verified. Links preferred. Please do not post something that may be a good exercise... subjective
Similar SO question 60109, but the answers dont meet my need here. I found that I've lost my touch (was thrashing ideas) with OOD after prolonged exposure to a day-job. Need to get it back..
Update: Are we collectively out of short OOP exercises ? I was hoping that I'd have a bunch to pick from. However my web-searches (this is a diff exercise in formulating the right search string) and the lack of responses here seem to indicate otherwise. Maybe I posted to SO at a bad time.. in which case bumping this thread for more responses.
http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata
http://schuchert.wikispaces.com/Monopoly%28r%29
Jeff Bay's Object Calisthenics. Following these will improve your OO skills.
Bill Wake's spreadsheet TDD challenge
Dave Thomas' CodeKata
Kindness,
Dan
From the AGPPnP book by Robert Martin aka UncleBob
CoffeeMaker Mark IV - Page 2 has the problem statement
Questionnaire Practice Problem
A problem I've worked on in a couple of different jobs is that of writing some generic, data-driven survey/questionnaire functionality. It's not majorly complex, but has enough interesting avenues to be a good OOD practice problem I think. It's definitely real-world and crops up in a lot of places.
You can start off thinking about how to structure a Survey. It is obviously made up of Questions, but do you also want Categories? Can a Question have subquestions? Can a subquestion have subquestions? How deep can you go?
A question probably needs to have potential Scores. What types of scores can you have? What types of questions can you have (multiple choice, multiple answer, freetext, etc.)?
Once you've got the basic business logic, you can also think about how you display a survey . Maybe you have a SurveyRenderer and a QuestionRenderer? How do you decide how to render different types of questions? (Maybe you use a Strategy pattern... as in this SO question.) How do you render a read-only version of the survey?
You can also think about persistence. How do you record responses to a blank questionnaire? How does your object graph of a survey get mapped into a database (or some other backing store), and vice versa?