Naming list of "status" [closed] - naming-conventions

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Oh dear, the time has come for me to iterate through a list of 'status' objects. When I have a list of objects I like to name it the plural form of the name of the objects it contains unless the objects are data types like strings: for example, a list of 'dog' objects would be 'dogs'.
What do you call a list of 'status' objects? Most dictionaries seem to say the plural is the same as the singular, 'status', but that won't work as there would be a naming conflict.

Singular: status
Plural: statuses
Dictionary definitions are less important than if someone will understand the code you've written, in a year's time or ten year's time. Everyone will understand that. Like Richie commented, move on with your life, you're gonna have bigger problems to solve.

Related

Relational DB : is it a bad practice to store data on relationships? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I work for a firm with a relational database. Some of my colleagues once told me that storing data directly on relationships (and not on entities) was a bad pratice. I can't remember why. Can you help me with that ? Do you agree ? What are the risks ?
Many thanks !
No, this is not a bad practice. In fact, "relationships" are often entities themselves. For instance, an "order" might relate a "person" and "store". It would also naturally have other information such as when the purchase happened, the payment amount, the total amount, and so on.
In general, when I create tables in SQL, I include information such as:
createdAt -- the date/time the row was created
createdBy -- who created the row
createdOn -- the system where the row was created
This would be true on all tables, even those representing many-to-many relationships.

Best practices for naming "State" field [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
When a U.S. address is stored, obviously it needs to have the state stored as well. The issue is that the word "State" is a reserved keyword in SQL.
What else should this be named? Are there any alternatives or do people just deal with having to wrap it in square braces?
Personally we prefer to use State as the property name and wrap it in queries or anywhere else there may be reserved word conflicts. We have not had any issues with this in the 3 years I have been on the team. Hope that helps!

Increment counter or query relations? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Let's say I have a User model and a Favorite model. I want to know how many favorites a user has.
I see that you can accomplish this in two ways.
Atomically increment a counter attribute on the user model when a favorite is created. Access using user_instance.favorite_count
Query the favorite count for the user: user_instance.favorite_set.count()
I would imagine that as the DB grows, counting becomes more expensive.
Which implementation is more scalable?
I smell some premature optimization here. Databases are extremely good at counting things. Unless you have measured and are seeing some identifiable slowness, you should not attempt to denormalize: it is difficult to get right and always at risk of getting out of sync. Go with the query; and don't forget you can use aggregation to query the counts for a queryset of users at one time.

sql database design - select & check boxes [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am designing a database for a form which contains many select boxes and check boxes lists.
I am unsure whether to populate these lists from a table in the database or from the select html text.
as part of db design best practice which is the preferred method.
If you expect the form elements (checkboxes, lists) are likely to change often, or are conditional (based on configurable permissions/roles), then they should come from a database.
However, if they are mostly static (rarely change, not dependent on configurable permissions), then you should hard-code them. The big benefit of hard-coding them is less traffic on your DB. This will yield the best performance.

What's the Necessary Items to Document on code? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
There is so many option in each programming languages which can be mentioned in the code documentation.
I want to know what are the most important Items which we have to document?
I'd document contracts (this parameter is expected not to be null, this function never returns null, ...) as well as the meaning (this method does that, ...). Besides documenting the API, I'd add comments on pieces of code which are non-trivial but add a significant value to the application (cryptic but real fast, works around a framework bug).
What you document ultimately depends a lor on who will read that documentation...