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
I have a coworker that keeps renaming object and method in my code. Add S, removing S etc..
I would like to know what is the best way in your opinion.
Suppose I have a class Client.
This Client can set two reminders (wakeupReminder and leaveReminder).
Each of these reminders have different settings.
So I created a Class called WakeUpReminderSettings. He told me that I should rename it to WakeUpReminderSetting because it is not a collection.
I also created a method that return all reminders settings. I named it GetClientRemindersSettings.
Again, he renamed it to GetClientReminderSettings. He's argument: Only the last word should be pluralized..
I would like to have your thoughts on this.
I think you're right in both cases. A WeakUpReminderSettings can be an aggregate of different settings without being a collection, and if your method return settings for multiple reminders, it makes sense to pluralize reminder even if it's not the last work.
Then again, naming conventions are really something subjective, if your coworker is not above you in the hierarchy, I'd tell him to stop messing with your work for minor changes like this.
Related
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 1 year ago.
Improve this question
I've looked around but I can't find anything related to managing your pages; by that I mean, everyone seems to just hardcode their page names and navigations to set pages all over the place.
Is this the recommended way of doing it? Just seems like you will have to do a significant amount of refactoring if things change.
If you guys have a setup you really like, I would love to hear about it :)
I've considered making a static lookup class, that can provide all the page paths and their equivalent navigations, but I don't know if it is an absolute overkill.
You can use reflection. Remember, each .razor file you create for a Blazor page will have the class generated for it that is the same as the name of the file. You can create a base class called BasePage and do #inherits BasePage on each of your pages. Then you have a singleton service that uses reflection to find all these classes and keep track of them that way.
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
We have to microservices.
How can we use an entity model from one microservice to another microservice without needing to maintain codes on both end?
The goal is to take the jsonData from a microservice and map it to entity model that exist in another microservice.
What is the best practice here?
You will need the assembly that contains the types you want to serialize/deserialize jsons. I think it is ok because when you have one service, you expect it to run autonomously, so, if you provide additional fields it should work (because it will not be affected by the deserialization). Now missing fields, the service will thrown exceptions and it is expected as part of the business.
One option, but not recommended (in my opinion), is to deserialize your json into dynamic and you will be able to navigate on the result as you want. I am not sure about the performance of this.
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
I've read Clean Code by R.C. Martin and I'm trying to adopt his suggestions about clean code as broadly as possible.
But I'm not sure how to name related classes.
Let's say I have a class named TreeDirectoryList.
I want to cut implementation of this class into many smaller classes.
Let's say I'll create a class named ParentIndexStack.
ParentIndexStack will implement functionality very dependent on TreeDirectoryList, so it's very not probable that this implementation of ParentIndexStack will be useful with any other class in the future.
But the name of ParentIndexStack is very generic, it's possible, that I'll need another class with the same name, within the same project.
So I thought I'll name ParentIndexStack more precise, like TDLParentIndexStack (prefix TDL is from TreeDirectoryList).
Would it be correct ?
I'll end with many classes starting with TDLxxxxx.
One option is to put that set of classes in their own namespace. Then you can have simple, concise names that still communicate the full meaning of the class through the namespace context.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am interested in best design pattern on below issue. Say I have 2 classes with different number of properties. I need to map instance of source class to target class' instance. Mapping source property may not be simply as just equal. There may conditional check and etc. As simplest way would be writing method and accept source class'object as parameter. Then manipulate properties and initialize target class' object. However it is not good, as there will be duplicate code and logic. Because there are will be many type of source classes. So, I will be forced writing code fach convertion. Something comes to my mimd generic methods? Thanks for your time.
Automapper worked fine for our team.
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
My MainViewModel has to deal with a lot of commands with complex actions inside, therefore its extension has grown inevitable. For keep the code organized I tend to use #region to group similar o related tasks.Does this considered an overuse of this feature or it's perfectly normal? You may say that it depends on me, if I feel right about it. I think that it helps a lot but I would like to know what do others. Here is a screenshot of how the code look like:
The bad practice is a massive single class. #region is simply hiding / coping with it.
If there are groups of methods, delegate them to another class.