MVC Proper Structure Packaging

I wonder to know, in MVC, I do understand what the generic division between M, V and C is but I am definitely not sure what are good ways to manage the files under these. Assume Golang. For instance, a project structure would be:

pkg/views/ pkg/controllers/                 group.go                   * has a BBQ                   * StoreTeamBBQAtTeamMember()                   * SetColorBBQ()                   * CreateBBQ()                   * DeleteBBQ()                 BBQ.go                   * SetColor()                   * Create()                   * Delete() pkg/models/  group.go                 group.go                   * has a BBQ                   * StoreTeamBBQAtTeamMember()                   * SetColorBBQ()                   * CreateBBQ()                   * DeleteBBQ()                 BBQ.go                   * SetColor()                   * Create()                   * Delete() 

My idea is that group.go has a BBQ and can manage it in a “group” way, whereas BBQ.go is the BBQ itself and that of course makes it have some intrinsic for a BBQ methods – create, delete. Apparently, my example leads to overlaps between how we model a BBQ and a groupBBQ.

My questions are:

  1. Shall we strive to keep some rigorous vertical semantic encapsulation of what we model? For instance, there won’t be groupBBQ and group controllers and models but group and BBQ

  2. Is it a good practice to speak call one model’s methods from another model?

  3. Is it good or bad one controller to call another controller’s methods?

  4. Is it good or bad one controller to call another model’s methods?

  5. Is it good or bad practice the controller of e.g. groupBBQ to call a method defined under BBQ?

  6. Are these modelled well, or all methods of a BBQ have to stay under BBQ even if they’re group ones?

The example I came up with on the fly but pretty much is a real life situation I’m dealing with. Lately I have been doing mainly microservices, no MVC and such overlaps I see here tenderly disturb me. 🙂

Proper display for Rejection of Request

I’m currently working on a project where user submit a media request, which then will be reviewed by another user (verifier).

I have done the display of information, but I’m not sure how can I show the “Rejection Reason”. For me this seems to be important, so I was thinking on putting it on top of the page, but this “Rejection Reason” use WYSIWYG editor meaning photos/attachment, or any text formatting is possible.

Also I was thinking… does it make sense to show the request details anymore, or do I just need to show the “Rejection Reason”?

Please note that once the request is rejected, we won’t allow it to be editing. So user have to create a request again. (So far that our process, if that’s wrong, let me know)

enter image description here This is the original wire frame of the idea, think of it as youtube like

Proper way to simulate arround steady-state point

When simulating a friction dynamic system, I have come to a problem when approaching steady-state.

In the example below, a box moves along a surface with a certain friction coefficient:

#!/usr/bin/env python # -*- coding: utf-8 -*-  import numpy as np import matplotlib.pyplot as plt  MASS = 1 # kg G = 9.8 MU = 0.3  TIME_STEP = [0.1, 0.01, 0.001]  SIM_TIME = 10 # s  for time_step in TIME_STEP:     t = np.linspace(0, SIM_TIME, int(SIM_TIME/time_step))     speed = 10 # m/s     s = []          for i in t:         Fr = -np.sign(speed)*MASS*G*MU         speed += Fr*time_step         s.append(speed)      plt.plot(t, s) 

Since the friction is only dependent on the speed unit vector, the system oscillates around the steady-state point instead of converging to 0. The oscillation vary depending on the time_step simulated, but it is there always.

Simulation Picture 1 Simulation Picture 2

The difficulty is that in the real system, the steady-state point is not known, so approaches like making the speed equal to zero when crossing the steady-state point are not applicable.

Is there a way for this to be coded in order to avoid those steady-state oscillations, and without loosing physical integrity?

Proper way to name a class which has just methods and not fields

GOAL: naming a class which has the responsibility to save data in Android database. The class structure is like this

ClassName {   public void saveSync(...){      /* implementation*/  }   public void auxiliaryMethod(...){     /* implementation */  } } 

QUESTION: which is the proper manner to name this kind of class? Should I always find a noun or can I use a verb?

Proper way to name a class which has just methods and not fields

GOAL: naming a class which has the responsibility to save data in Android database. The class structure is like this

ClassName {   public void saveSync(...){      /* implementation*/  }   public void auxiliaryMethod(...){     /* implementation */  } } 

QUESTION: which is the proper manner to name this kind of class? Should I always find a noun or can I use a verb?

Proper way to name a class which has just methods and not fields

GOAL: naming a class which has the responsibility to save data in Android database. The class structure is like this

ClassName {   public void saveSync(...){      /* implementation*/  }   public void auxiliaryMethod(...){     /* implementation */  } } 

QUESTION: which is the proper manner to name this kind of class? Should I always find a noun or can I use a verb?

Proper Use Of HTML Data Attributes

I’m writing several JavaScript plugins that are run automatically when the proper HTML markup is detected on the page. For example, when a tabs class is detected, the tabs plugin is loaded dynamically and it automatically applies the tab functionality. Any customization options for the JavaScript plugin are set via HTML5 data attributes, very similar to what Twitter’s Bootstrap Framework does.

The appeal to the above system is that, once you have it working, you don’t have worry about manually instantiating plugins, you just write your HTML markup. This is especially nice if people who don’t know JavaScript well (or at all) want to make use of your plugins, which is one of my goals.

This setup has been working very well, but for some plugins, I’m finding that I need a more robust set of options. My choices seem to be having an element with many data-attributes or allowing for a single data-options attribute with a JSON options object as a value. Having a lot of attributes seems clunky and repetitive, but going the JSON route makes it slightly more complicated for novices and I’d like to avoid full-blown JavaScript in the attributes if I can. I’m not entirely sure which way is best.

  1. Is there a third option that I’m not considering?
  2. Are there any recommended best practices for this particular use case?

Proper way to run Rider without Missing Templates

I’m using Ubuntu x64 18.04 and Jetbrains Rider IDE 2019.1.3

If i download rider with snap or download & extract tar.gz file; I can run rider with clicking app icon on Ubuntu’s launcher / unity. It opens but rider’s project templates(console app, webapi, xunit test app etc) are missing. But if I run rider with sudo like “sudo ./rider.sh” project templates are showing correctly. So what is the proper way to install and run rider? Is launching rider with sudo a bad thing for security? Do I need to give some kind of chmod or admin rights to rider.sh? All I need is install and run rider with unity click – and it should work without errors like missing project templates or debug dll needs execution rights etc.