Constructors with "too many" parameters Assume that I have some subclasses that extend a superclass. These subclasses differ by the parameters passed to the superclass. Unfortunately, like the following example, I can end up with "many" parameters. Is there a general method of avoiding this? Are constructors with "many" arguments considered good practice? Would it be better to have getter/setter methods instead of passing every parameter via constructor?  public abstract class SuperClass {     private int a;     private int b;     .     .     private int z;      public SuperClass(int a, int b, ... int z) {         this.a = a;         this.b = b;         .         .         this.z = z;     } }  public class SubClass1 extends SuperClass {      public SubClass1() {         super(4, 3, ..., 9);     } }  public class SubClass2 extends SuperClass {      public SubClass2() {         super(1, 7, ..., 2);     } }
Managing constructors with many parameters in Java In some of our projects, there's an class hierarchy that adds more parameters as it goes down the chain. At the bottom, some of the classes can have up to 30 parameters, 28 of which are just being passed into the super constructor.  I'll acknowledge that using automated DI through something like Guice would be nice, but because of some technical reasons, these specific projects are constrained to Java.   A convention of organizing the arguments alphabetically by type doesn't work because if a type is refactored (the Circle you were passing in for argument 2 is now a Shape) it can suddenly be out of order.  This question might be to specific and fraught with "If that's your problem, you're doing it wrong at a design level" criticisms, but I'm just looking for any viewpoints.
When needing to ask a professor about something important and potentially delicate, what is an appropriate way to phrase the question or write the email?  Examples include:   Requesting a recommendation letter Asking for exceptions to policy (e.g., ignoring a course prerequisite, rescheduling an exam) Asking if you can do research with them, join a group, get into a program Scheduling a meeting, exam, or defense Letting them know about a change of plans Letting them know about a life event affecting your work or studies (e.g., wedding, funeral, sickness, vacation) Make back/forward work on paginated lists What is a natural response to &quot;Good to see you. How you doing?&quot;? Will a natural response include &quot;doing&quot; as in &quot;I'm doing okay&quot; or will &quot;I'm okay&quot; be more natural? Is $\sin^2(z) + \cos^2(z)=1$ still true for $z \in \Bbb{C}$? Is $$\sin^2(z) + \cos^2(z)=1$$ still true for all $z \in \Bbb{C}$? I've tried rewriting it using complex definitions of $\sin$ and $\cos$, and I don't see why it wouldn't, but the text I'm reading asks this question as if it shouldn't hold? How does two-weapon fighting work? I'm quite confused about attacking with two weapons in both hands and wondering what is required to be able to do to (in Pathfinder).  1. Base Attack Bonus Looking at the base attack bonus tables for different classes (e.g. the ) it seems like up to +5 you get only one attack per full action but starting from base-attack-bonus of +6 you get a second attack with +1.  2. Feats There is a feat . The existence of the feat sounds like you could not do two-weapon-fighting without it. However, in the description of "normal" it says:     If you wield a second weapon in your off hand, you can get one extra attack per round with that weapon. When fighting in this way you suffer a –6 penalty with your regular attack or attacks with your primary hand and a –10 penalty to the attack with your off hand. If your off-hand weapon is light, the penalties are reduced by 2 each.   3. Core Rulebook Chapter about combat If I understand the  it says that you need a full-round action do attack with both weapons in two hands.  So how do these things interact? Can I only attack with my off-hand weapon if my base-attack-bonus is high enough that I get second one with +1?  If not, how does the "multiple attacks from high base-attack-bonus" interact with dual-wielding? Assuming I reached a state of base-attack-bonus with +11/+6/+1 and have a full-round action to attack. Does that mean I can either attack with my primary weapon three times or use the primary weapon and off-hand weapon to attack only twice? Why would I then ever choose dual-wielding? Or can I attack three times with both weapons (leading to a total of 6 attacks with heavy malus) Or would I get 3 attacks with the primary weapon + 1 attack with the off-hand weapon? If so, what attack bonus do I have to use for each of the attacks? How to ignore deprecation warnings in Python Magnetic field lines When I searched the net about magnetic field lines,  told something about contour lines and that magnetic materials placed along a magnetic field has some specific loci, which i did not understand. Can someone explain it to me in details.  Also how do we know that tangent to a magnetic field line gives the direction of magnetic field? I am very confused. Should I add a 'Home' Button to the navigation? I know that it is common behavior to have the logo of a web page be a link to the home page, but should I also have a 'home' link in the navigation bar for it as well? Initializing K-means centers by the means of random subsamples of the dataset? If I have a certain dataset, how smart would it be to initialize cluster centers using means of random samples of that dataset?  For example, suppose I want 5 clusters. I take 5 random samples of say, size=20% of the original dataset. Could I then take the mean of each of these 5 random samples and use those means as my 5 initial cluster centers? I don't know where I read this but I wanted to know what you guys think about the idea.    UPDATE: Please see this thread  for the general discussion about the various initialization methods. Most efficient way to test equality of lambda expressions Something I did in the first Animal Crossing was make a house on an alternate character solely to showcase bugs/fish I felt were too cool to only leave in the museum. However bugs can't be mailed or dropped, so I'm at a loss as to how to do this.  Is there a way I can give bugs/fish to a second character or will that character have to find them themselves? Calculate $\lim_{n\rightarrow +\infty}\binom{2n} n$ How can I increase my disk space when Ubuntu is installed inside Windows? SSH tunnelling with multiple dynamic port forwardings I am trying to monitor multiple JVMs running on different servers through an ssh tunnel.  Thanks to one of the UNIX gurus here, I have managed to get this running for a single server by:   Run jstatd on the target server Set up Visual VM to use 9696 as its socks proxy port. On my local PC, run:  ssh -L 2222:server1:22 bastion-host  On my local PC, run:  ssh -o port=2222 -D 9696 -L 1099:localhost:1099 localhost    This does the trick. Now when I try and tunnel to a second server I try:   On my local PC, run:  ssh -L 3333:server2:22 bastion-host  On my local PC, run:  ssh -o port=3333 -D 9696 -L 2099:localhost:1099 localhost    However, the last step complains with:  bind: Address already in use channel_setup_fwd_listener: cannot listen to port: 9696   Has anyone managed to do something similar?  Update:  The reason this is so complex is that jstatd is an RMI server application:    As with RMI applications, these register with an rmiregistry. Using rmi through a firewall requires me to use SOCKS as described here:    Unfortunately, visualvm only lets me set the SOCKS proxy port once, and the -D option won't allow me to forward the same local port to both servers... It is well established that:   'In quantum mechanics, the behavior of an electron in an atom is described by an orbital, which is a probability distribution rather than an orbit.   There are also many graphs describing this fact: : (hydrogen atomic orbital - one electron) In the figure, the shading indicates the relative probability to "find" the electron, having the energy corresponding to the given quantum numbers, at that point.  My question is: How do these symmetries shown in the above article occur?                 What about the 'preferable' axis of symmetries? Why these? I've heard Google's algorithm is based on PageRank, and that it has something to do with the links to your site. Can someone explain it, and more importantly, how I can increase my site's PageRank? Is cancer caused by vitamin B17 deficiency? Evaluating $\int_0^\infty \sin x^2\, dx$ with real methods? I have seen the Fresnel integral  $$\int_0^\infty \sin x^2\, dx = \sqrt{\frac{\pi}{8}}$$  evaluated by contour integration and other complex analysis methods, and I have found these methods to be the standard way to evaluate this integral.  I was wondering, however, does anyone know a real analysis method to evaluate this integral? How do you properly use namespaces in C++? What Canon lens would one use for Sartorialist-like street photography? You probably know Scott Schuman and his blog (). What kind of lens (that is not expensive) would you recommend for Canon 550D to achieve similar effect (in terms of DoF etc.)? I'm a newbie so I'm not sure how to properly interpret those photos' EXIF info. My guess is, that a similar effect can be achieved using .   PS:   Update: Thank you guys for all the answers, it's much more clear for me right now. I think I'll try the Canon 50mm f/1.4 lens.