question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Renaming of methods' Problems

See original GitHub issue

In the next release of SimPEG we are renaming many of the base properties to be more in line with pythonic conventions, pep8, etc., and we are also refactoring to get rid of SimPEG’s Problem and replacing it with Simulation (which moves the forward operations from a Survey object that has been paired with a Problem to just a Simulation). As part of this, I’d also like to update the names for each method’s problems, to have a consistent convention across SimPEG.

Currently

For example in FDEM and TDEM, the names are

  • Problem3D_E
  • Problem3D_B
  • Problem3D_H
  • Problem3D_j

In natural source em:

  • Problem1D_ePrimSec
  • Problem3D_ePrimSec

In the static methods IP, and DC, they are

  • Problem2D_CC
  • Problem2D_N
  • Problem3D_CC
  • Problem3D_N

The simulations in the potential field methods are currently

  • MagneticIntegral
  • Problem3D_DiffSecondary
  • GravityIntegral
  • Problem3D_Diff

In VRM

  • Problem_Linear
  • Problem_LogUniform

And the others:

  • RichardsProblem
  • StraightRayProblem

As you can see, the convention in naming is certainly not consistent, and we should make a decision moving forward of a good convention that incorporates the Simulation name possibly. Some things we might want to keep are, distinguishing between dimensionality of a simulation, possibly being able to use autocomplete within each package to find the simulations (a.k.a. they would all start with Simulation), being descriptive with the names, etc. We would like to keep pep8 conventions for class names. Keep in mind that the method names would already be a part of the path to the Simulation class.

Mostly try to think about how suggestions would propagate, as some things might get quite long. For example I’ll put out three possible formats:

Simulation(Dimension)(ShortDescription), Simulation(Dimension)(LongDescription), (LongDescription)Simulation(Dimension).

For Example

  1. Problem3D_ESimulation3DE or Simulation3DElectricField or ElectricFieldSimulation3D.

  2. Problem3D_BSimulation3DB or Simulation3DMagneticFluxDensity or MagneticFluxDensitySimulation3D

  3. Problem3D_jSimulation3DJ or Simulation3DCurrentDensity or CurrentDensity3DSimulation note here, should j be capitalized or not?

  4. Problem3D_CCSimulation3DCC or Simulation3DCellCentered or CellCenteredSimulation3D.

  5. MagneticIntegralSimulation3DInt or Simulation3DIntegral or IntegralSimulation3D

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jcapriotcommented, Feb 27, 2020

Just to keep this updated, we had a nice discussion on this at the last SimPEG meeting (Feb. 26th, 2020) and decided on a general format of Simulation(Dimension)(LongDescription).

With two major thoughts, the first being that a longer description allows an unfamiliar user to better understand what it is. The second, that you can always do something in your own code such as from SimPEG.electromagnetics.frequeny_domain import Simulation3DElectricField as Sim so it doesn’t need to be typed out every time.

0reactions
lheagycommented, Feb 26, 2020

Thanks for getting this going @jcapriot! I agree with the general naming convention of Simulation(Dimension)(ShortDescription). This keeps the names grouped together when tab-completing, and stays fairly compact.

So my vote is with the pattern

  1. Problem3D_ESimulation3DE

  2. Problem3D_BSimulation3DB

  3. Problem3D_jSimulation3DJ

  4. Problem3D_CCSimulation3DCC

  5. MagneticIntegralSimulation3DIntegral (here I think Integral is worth spelling out b/c Int maps to Integer in so many other contexts)

for visuals, I am also fine with lower-casing the E, CC etc

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rename Method - Refactoring.Guru
Perhaps a method was poorly named from the very beginning—for example, someone created the method in a rush and didn't give proper care...
Read more >
How to fix this method renaming problem with Java 8 ASM
Recently I coded an Obfuscator with ASM in Java and wanted to rename classes, methods, and fields. But the problem is, that the...
Read more >
Rename does not rename methods across classes in hierarchy
Issue Type: Bug If I refactor rename an overridden method, it does not rename the base class method, and vice versa.
Read more >
Should we rename overloaded methods?
If you rename a method, it is no longer going to be overloaded. In and of itself, overloading doesn't necessarily make code less...
Read more >
Renaming an overridden method in a C++ class does not ...
I have a class that implements an interface in native C++ code. Renaming an overridden method in a C++ class renames the method...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found