Dienstag, 18. Februar 2014

My LED-light Experiment

A while ago I experimented with LED-Bulbs to see if the could help me lower the energy footprint of my house. Just by replacing a few bulbs (far from all, and not all to LED!), I easily threw out 181Watts (that is if all of these bulbs burn at the same time - which is practically never the case) and in some places it is now even brighter than before. A reduction of about 2/3's and there's still potential. Here are a few things I've learned:
  • Finding the right Wattage for your bulbs is difficult. There are some tables online that help you (Watts to Lumen), but that's only a hint and you will have to experiment to find the right number. Both numbers do not help you find out how the light will "feel". A real problem, when buying online.
  • LED light bulbs are surprisingly heavy. And some LED-Bulbs are actually huge, so buying on the internet might give you some surprises.
  • If you really want to save energy check the lm/W-ratio of the bulbs you want to use. There are big differences... The top ones are above 100 lm/W (classic bulbs: 10-15 lm/W).
  • 12V-Systems are a bit tricky. I burned a transformer, although a friend "who should know" told me that was impossible. Maybe it is, but you may still have to change it, because transformers have a minimum power usage requirement that you might not hit with your LEDs: I have a 2x10W-halogen-lamp that does not light up, when I replace one of the bulbs with a 2W-LED (it just flashes about once a second). Note also that the transformer I bought had a little paper that told me that you should buy a LED-transformer with the bulb-wattage times 1.5! So for my 4x2W-kitchen-lighting, I'll need at least a 12W transfomer. I did not know that before... I've also heard of LEDs flickering with older transformers - but I have not seen that myself.
  • The light from LEDs feels definitely colder than from classic bulbs. There are really good bulbs that try to overcome that; and this will most likely get better in the future. But for now, you'll have to experiment (and ask the rest of the family) if you can live with that. I'd say the light is comparable to those energy-saving bulbs (CFLs??), and I would recomment to use LEDs istead of those because they do not contain mercury (=health problem) and they cannot really explode (no vacuum). There are even ruber-led-bulbs that you probably can play Squash with... ;-)
  • LEDs are advertised as having 100% light immediately - that's not entirely true: Many bulbs have a initialization time that is noticeable but well below a second. But you can see ist. I also find interesting that the opposite is true: LEDs are immediately dark, when you switch them off! When experienced for the first time, this is a bit creepy, because you probably did not notice that is different from classic bulbs: they glow out. Subtle, but different.
  • The bigger problem is that LEDs emit light into a specific direction. This is the reason why you should have a look at the angle of radiation of your targeted bulb. The best fit for LEDs are spotlights! IMHO if LEDs take off more, we'll see a lot more indirect lighting, because it is simply easier to build them with LEDs. When replacing a classic bulb in special lamps you might end up with only half of the room lit. I have that in a few wall-lamps where the bulb is attached horizontally - there are not many LED-bulbs that are usable there.
  • LED Bulbs not really stay cold - they do get warm; but you most likely will not get burns...
  • Don't even think of hybrid solutions for a certain multi-bulb-lamp - i.e. mixing classic bulbs with LEDs (Thinking you want to have the warm light of classic bulbs and the savings from an LED). It just does not look good because you can see the difference. This is worse for dimmable lamps, because LEDs and classic bulbs have a different dimming curve. Believe me, it is ugly. If you don't like the LEDs light color - stay with classic bulbs.
  • There are a lot of crap-led-bulbs out there.
  • Don't expect too much money saving from replacing the bulbs, because if you're like me, then lighting is not the biggest consumer of energy in your house. Especially considering the price of an LED-Bulb, it might take a few years to break even with normal bulbs. But: the longer the bulbs burn per day, the faster you save. Tip: Actually try to find out how long (per day) the bulbs are used, and remember that this changes through the year (unless you live near the equator...). Then replace the ones with the highes usage and actually do some calculation; this is the most economic way to do it. Replacing a 25W bulb in the food storage that burns a few minutes a day at max will probably take a century to save anything...
  • It does not have to be LED: Shame on me - I still found 60W classic bulbs in my house. Replacing them with 42W-Halogens gives about the same amount of light (in almost the same color), but already use a lot less energy. There is basically no reason not to do at least this!

Samstag, 15. Februar 2014

Reorganizing class internals

A lot of code I looked at has the private stuff of a class on top (I'll say private in the following, meaning everything invisible from the outside like protected, internal...). The code starts basically with a section of the member variables, followed by private functions. In many cases then starting to mix public and private members. I dont know if that's really universal, but a lot of my collegues seem to do it that way.
I did, too.
I guess thats something we learned from older languages like Delphi where everything needs to be defined before it can be used; and as the public members will most likely call or use the private ones, the private stuff has to come first. More modern languages like Java and C# do not require that any more, be we stick to old habits. But... Is that good?
I now tend to say NO, because the most important thing of a class is its public interface. So THAT should come first. Private members are just details of the implementantion, and only need to be looked at when you want to find out HOW the class is doing what it's doing. But that's usually interesting after you know WHAT the class is supposed to do (which the public interface should tell).
After a few experiments in smaller projects this actually seems to work for me. Now I'll try to use that in bigger ones.
I'll keep you updated if it keeps working for me.
What do you think?