When I add a new parameter to a java method, should it always be at the end of the parameters or are there other principles?

What is the common practice of adding parameter to a method of a java class?

Normally if I am modifying an equivalent method written in older python (without type support), I naturally put the new parameter last to avoid making changes to existing code.

However here is my situation:

class A {    public void doSomething(File infile, File workingDir) {      ...    } } 

Now I want to introduce an Enum type that is related to the type of infile and it needs to be passed to the method doSomething:

public Enum FileType {   int DATA,   int IMAGE } 

In this case, should I put the parameter FileType fileType to the very end

class A {    public void doSomething(File infile, File workingDir, FileType fileType) {      ...    } } 

The pro is: it is predictable. Every new parameter will be added to the end.

However I feel that in my case, infile and fileType are more closely related to each other, they should be grouped together.

class A {    public void doSomething(File infile, FileType fileType, File workingDir) {      ...    } } 

I think the second approach is suitable to a statically typed language like Java. I have not been able to find much about parameter ordering in common style guide.

So what is the right thing to do in my example? What is the best practice in Java?

wasserman principles of exercise testing and interpretation

=========> Download Link wasserman principles of exercise testing and interpretation

Tags:
principles of exercise testing and interpretation wasserman free download
wasserman principles of exercise testing and interpretation download

Latest Downloads:
wedding march song mp3…

wasserman principles of exercise testing and interpretation

Examples and suggested principles of designing dissipating usage tracking experiences?

I was wondering if anyone could assist, I’m not sure what the correct terminology for this is, and therefore struggling to find any research on it.

I’m designing an experience where users have a certain amount of ‘uses’ of a product, but need some sort of visual indicator in-product that advises of their current usage to understand that once their use amount has dissipated, they can no longer use the product until a certain date, or perhaps further usage will cost extra. Perhaps even indicate their additional usage beyond their given amount somehow. (they are likely to be able to carry on using the product anyway)

I guess a similar example would be data usage.

I’m seeing lots of research and examples on progress tracking, however this is a little different. Can anyone advise of any research I could read on this to advise or inspire, and perhaps some examples of current uses please?

How to adhere to pure REST principles when different functionality is required in different situations

We have a RESTful API that allows for creation of users by POSTing to a particular endpoint, api/v1/users

In the system, when a user is created, an email is sent to the user with content along the lines of “{Authenticated user} just added you to the super cool system and you can now do all sorts of things”

However, in some cases, when a user is created via the API, we don’t WANT to send that email to them. Say it’s some sort of import process or something – the developer has their data already, and does not want to send any such email.

The debate in our office is the following:

Viewpoint A: “This is an example of how RESTful web services fall down. Instead of POSTing to an endpoint for creating a thing, instead there should be command endpoints for each function that can be performed by the system, so each thing you can do is represented by a command, and if any metadata about that command is necessary, you can add it”

Viewpoint B: “The fact that you don’t want thing x to happen when thing y is created means there are either two types of thing y, or thing y has a status which, if different, causes different things to happen when it is created. Therefore you can still adhere to strict RESTful principles”

Can this situation be reconciled with pure RESTful principles? Isn’t the metadata a pollution of the “user” entity, and therefore an argument for there being commands for each thing you can do within the system? (Perhaps you can see which side of the argument I fall on…)

What can I consider to help me decide whether the refactoring process of legacy code towards using modern OOP framework principles is worth it? [on hold]

I am refactoring old legacy code as part of my job. My chosen framework is Zend Expressive that runs on PHP, where I am using Zend Expressive Skeleton app (app provided by the maintainers) as a guideline. Zend Expressive among other coding constructs uses config, factories, handlers, view templates. I am then free to provide my own architecture, where I use repository and service layers.

In my case, what I mean by legacy code, is code with it’s own framework of sorts that in comparison to Zend Expressive mixes the following concepts into one file:

  • service creation
  • factories creation
  • request handler creation
  • repository calls in a form of global functions, which call the database
  • view templates, aka html/js/css is in the same file

Transformation

What I do is a transformation of that described one file into the separate concepts (as ones above). This creates lots of separate files. It’s a sort of surgery-like extraction, where it takes time, and work and cognitive work – understanding how to name each file/class/object, how they are to connect, wire them up together and fix up any bugs that are created either due to incorrect extraction or due to the upgrades to the layer. i.e. I usually use new database layer that returns typed data rather than just strings. Some methods need to be updated to accept typed data that is not always a string.

I am trying to figure otu if doing so is “worth it”, since such transformation takes time, while functionality of the software effectively remains the same.

Question:

What factors can I consider when making a decision on whether such transformation (refactoring process) is worth doing?

Alternative to refactoring is to keep this legacy code as-is, and make changes to it without disturbing its original cohesive one-file structure.