Mating behaviours of dragons

My question is about the social behaviour of dragons in regards to the opposite gender. I’ve read a few small pieces about breeding and territorial behavior of dragons, but nothing substantial that I have come across, so my question is if there are any sources for their behavior or what the behavior is.

In essence my question regards the following things:

  • Territorial behavior
  • Breeding behavior

Territorial

Dragons are or can be, from what I read, quite territorial. Originally, I had assumed that they don’t tolerate other dragons living in their territory; but the info about the Red Dragon Ruler of the Five Kings Mountains vanquished that thought, as he tolerates not only wyverns but even other dragons inside his territory.

For this section, the question is: Do dragons who are mates end up sharing lairs or not? (I read one instance in the newer dragon books where a dragon was killed while he tried to visit the female dragon who laid their eggs… so the two dragons had lairs quite far from each other)

Breeding

Here the question is if dragons mate for life, if they are only together for laying one hatch of eggs and then go separate ways, or if it’s more a mix of those two depending on the dragons in question. And also related to this is who decides that two dragons are going to lay eggs. As an example, in Shadowrun, with very rare circumstances (which brings a mortal enemy to the other dragon) the female dragons decide from whom they lay eggs.

Also related here is: Do both dragons care for the eggs or only the females?


Like I said I’m interested if this info is standing somewhere such as books, or if there is a general consensus on these things.

Specific UI preferences & user behaviours in Singapore

I am currently working on an SG site where I have changed the width of reading columns to keep to best practice for reading. I have now been told that customers are complaining of the white space thats now there (still waiting on the evidence).

This had me thinking about moving away from global best practices and try to find any specific UI preferences & user behaviours for Singapore customers.

So far I have yet to find anything beyond buying & device using statistics. A quick view at the most popular ecommerce sites shows examples of stronger colours and more information density. But I was wondering if there is any other sources out there that can give me greater insight.

How to implement a combination of behaviours for my objects

I need to create a program to manage an association.

Members of this association have different roles and each role has specific characteristics. My problem is that I’m not able to abstract this concept in my program. This is what I thought so far.

Create a class Person that has generic attributes for members and not members such as Name, Surname, Birthdate, etc. Then create a class Member that inherits from Person adding some attributes for the members such as Id, EnrollmentDate, etc.

As regards the role, I thought to use interfaces. For example, if a member is an instructor, IInstructor, if he/she is a vehicles manager, IVehiclesManager, etc. and each one has a different behaviour.

My problem is that a member for example can be both an instructor and a vehicles manager and I don’t know how to implement this. Do I have to create three different classes, one that implements IInstructor, one IVehiclesManager and one that implements both or is there another way to do this?

The problem is that there are various roles and each member can have any combination of these.

It’s the first time I use interfaces and maybe I’m missing something. Am I on the right way or should I use a totally different approach?

How to inject behaviours to an abstract class?

I am trying to modify an opensource project (json serialization one: gson, I want to let it serialize/deserialize objects with circular references, which is not allowed now. ) to do it I have to change an abstract class widely extended.

I want to change the behaviour of that class with a strategy object so every child classes will be using it without needing to know it, so I have add the strategy object to the abstract class. As draft, I have done this:

... public abstract class TypeAdapter<T> {    CircularReferenceStrategy<T> circularStrategy = (new CircularStrategyFactory()).create();    public void write(JsonWriter out, T value) throws IOException{     circularStrategy.write(this, out, value);   } /**    * Writes one JSON value (an array, object, string, number, boolean or null)    * for {@code value}.    *    * @param value the Java object to write. May be null.    */  public abstract void doWrite(JsonWriter out, T value) throws IOException; ...  

That circularStrategy can be, p.e: let it fail by throwing a StackOverflowException (actual behaviour), or substitute circular references with ‘null’/NullObjects or, as is done in Jackson (another serialization library), mark each object with an ‘id’ and add a reference to that id in the serialized json so the serialized/deserialized objects will have the circular references… whatever, the point is that they can be many strategies and that one of them must be selected before starting the serialization.

So my question is:

How should I tell the factory which strategy must be used?

I would set the info about which strategy must be used up in the GsonBuilder* and inject it to the abstract CLASS TypeAdapter (as a static field, to the class, not to the instances) but there is something that stops me from doing that, a spider-alert… Is it ok to inject things to a class? from where?

How would you do this?

* That is the main builder of the library, it builds a Gson object that has toJson and fromJson methods that are what you use

JS – Handle custom behaviours based on attribute value

I’m a developer that has the entire background based on languages with OO/FP approaches and now I’m working with NodeJS.

For me, it’s something new and, sometimes, kinda confusing. Right now, I need some help to organize my code instead of keep using IF/ELSE in a big function.

I’ve wrote an API that is used by many departments of my company. Most of departments has a common behavior on code but two departments must call another APIs to build their objects instead of use a common one shared by others.

If I was writing same code using Java, I could use some polymorphism to satisfy customizations in code but I have no clue on what’s the best approach to solve it on Javascript.

Here is what running on production:

  function openTickets (event, config) {     // more code     let user      try {       if(config.department === 'HR'){ // TODO move          const usersResponse = (await company.getUser(phone, customData.zipCode)).body  // this is a http call using got             if(usersResponse.results.length > 0){           user = usersResponse.results[0]         }                } else {         user = {           //....         }       }     } catch (err) {       console.log('error getting user', err)     }     //more code   } 

This is just an example on how I’m solving customizations on code and creating a Frankenstein that will be pretty hard to maintain in a few weeks.

What is the best approach to customize specific behaviours on Javascript instead use IF/ELSE?