Tuesday, June 6, 2023

Jokes for my kids

My kids like to grown at my "bad dad" jokes. I come up with quite a few but I tend to quickly forget them before sharing.  I hope to capture many of the jokes here so they can be shared later.

  • What did the sheep say when a pig told them that all the cows got stuck in the mud by the pond?
    • The sheep said that is a "Cow-tastrophe".
  • What did the carrot say to the mature green onion when it saw containers of new onions?
    • You should be proud of your bunches of "bunches of [baby] onions"!

Here are my Chick-fil-a jokes from some time ago.

Random ideas and questions

  1.  Since the gravity from a black hole pulls in both light and matter, how might someone determine the effect on matter as it is drawn into a black hole?
    1. Could quantum entanglement be used? If two atoms were quantum entangled and one was released into the gravity of a black hole could you monitor the remaining atom for changes in spin patterns as the other atom is drawn into the black hole? What about trying to change the spin of the local atom and determine if there is any type of resistance to change in the spin? Would we even know if/when the quantum entanglement was broken or disrupted?
  2. Every CNC type machine I am aware of uses electric motors (servo or stepper) to drive a screw rod which then moves a platform or device. As the desired max distance increases, it becomes more difficult (or expensive) to handle larger speeds due to rod "flapping" (over a distance without any intermediate supports). Thicker/stiffer rods or reduced speeds often help. Is there a potentially better method available?  Maybe an electric motor with a hollow threaded shaft mounted to the platform instead? So instead of the long threaded shaft spinning, the electric motors threaded shaft spins and moves the platform along the threaded rod?  Downside is extra weight of electric motor on top of the normal platform/device weight. 
  3. Homes have all types of appliance that either generate, consume and/or move heat from one place to another; Clothes dryers create heat, hot water generation creates and/or consumes heat, refrigerators and HVAC move heat between locations. Would it be useful/possible to design homes with a "central heat exchanger" where waste heat could be transferred to devices needing heat? i.e. Heat produced by a clothes dryer might get transferred to a water heater instead of directly vented to outside a house. This might need intentional design support for appliances and there are likely issues with "dirty sources" like lint in dryer exhaust. Probably many other issues I'm not thinking of this second.
  4. Hot water is useful and needed for many things - showers, baths, washing dishes/clothes, pool heating, etc. In warm climates, using some form of solar heating of water usually involves use of some type of plastic piping, etc which is directly exposed to sunlight - where the heat transfers through the pipe into the water/liquid which then is moved somewhere else for use.  The piping outside is usually on a roof or possibly even taking up space in a yard.  Instead of having external piping, would it be efficient enough to use attic space?  The roof area is typically pretty significant so a huge amount of piping could be run in between rafters/trusses. Lack of direct sun reduces efficiency but the larger area and tendency to retain heat may make up for it - although cost may be a limiting factor. I also wonder if using the "waste heat" from an attic may provide a benefit of lowering cooling needs for a home? There would be obvious concerns about leaks in an attic but I wonder if techniques used for joining pipes for underground geothermal lines might work well. There is also the "my roofer used too long of a nail" type problems to avoid.
  5. If small drones were combined with helium "balloons" for lack of a better description and light weight, flexible solar panels with power storage - could it maintain flight for weeks or more? Could modular, self-assembling floating platforms be created from groups of drones? It would likely need some sort of method to prevent "flapping" of the joined drones - maybe some sort of torsion bar joined across the drones.  I visualize this like torsion bars in cars and trucks. I don't consider this "floating" drone as a close cousin to blimps, etc - it would be more aerodynamic and suited to maintaining its location with relatively low power consumption.  Applications of this might include long term monitoring of beaches and shallows (for sharks, etc), wildlife movements (pythons in Florida, turtle nests in remote areas), security, ground monitoring (sinkholes?), disaster relief deliveries, search/rescue, etc. Some domains are likely better handled by simpler technology so this would be more specialized. Domains of use should require fast setup, easy to relocate/remove/replace, reduce danger to human life for placing/operating/monitoring.

Monday, April 10, 2023

Selecting technology for a software system


Selecting technology for a new software system is challenging. There are very diverse technologies available and opinions on each are equally diverse. You may find some people with the opinion that the selection isn't hard because there is only one good choice (or close to it) - in their opinion given their requirements and assumptions.  

Why do I feel the selection is difficult? There are a number of reasons. 

  • Is there a perfect programming language for all needs?
    • No; each language has trade-offs.
  • In a number of cases, a specific language may be a good choice but you also need to consider different runtime environments for a language and the inherent trade-offs.
  • Different business domains / uses may match up better to specific languages or technology stacks.
  • A language / runtime isn't a solution on its own; you also need to consider the overall environment in which the software will operate.
  • Some software systems require higher security and some technology stacks are more mature in that area.
  • Some systems are especially sensitive to the speed of implementation.
  • The expected lifetime of a system and maintenance needs affects choices.
  • The maturity of the 3rd party ecosystem for a language / tech stack affects choices.
  • Another item which tends to be considered but usually without thinking about it is - what languages are your staff skilled with?
  • And then you have the choices affecting performance, scalability, reliability, cost, etc.
The above list is a bit abstract in nature.  What are some very real and important examples?

A common language that comes up often as the "golden choice" is Python. Is Python a good language - yes, for appropriate uses/domains.  I won't dive into what are good uses for it, I tend to prefer knowing how to rule out items so I can get to a short list for final selection. In the case of Python, what aspects are worth considering? 
  • Memory handling
  • Threading / Giant lock
  • Build time / dependencies
  • Backers of the language
One aspect of memory handling that is problematic (at a minimum for CPython) is that there is no control of limits by the runtime system. In standalone / local applications, this isn't a huge burden but if you are using a containerization / orchestration type systems such as Docker or Kubernetes (K8S) then you run into a dilemma.  Docker / K8S enable you to set memory limits and when those limits are exceeded, generally the container is killed and restarted.  The CPython runtime isn't aware when there is memory pressure and isn't tuned to attempt to prevent over-allocation.  To prevent containers from over allocating memory and being killed - more headroom memory is needed per container instance.  This can reduce the efficient use of memory which increases cost.  If you try to run more CPython processes in a container to improve generally efficiency - you can cause more workloads to restart due to a single over-allocation. The result is poor user experience. Increasing the number of container instances requires adequate memory for each which translates into higher costs.  

CPython also has a giant lock which impedes its multi-threading capabilities (Python GIL / Threading). So managing high request rates in a web application may provide some challenges. You may think it is easily resolved by use of some messaging type system (maybe Kafka, MQ, etc) but if the client libraries don't work-around the inherent issue then you end up with problems that may be hard to diagnose and even harder to fix. 

If you are using a standard interpreted version of Python then you don't really need to worry about build time related to your actual code but you may need to deal with the time required for building any required native dependencies. There are many libraries that work with Python but they are implemented using native libraries which the Python runtime loads and uses. This often means you need C/C++ and / or other compilers to enable building the native libs. This can be slow and error prone when working with containers initially. Given time and effort, you can create a solid build process but this is something that brings the overall complexity of creating, containerizing and deploying a software system to levels similar to compiled languages.

Every popular language remains popular by changing enough to meet new needs and challenges in the software development ecosystem. In some cases, languages are backed by committees (C++) and others have a community/large organization as the primary backing (Java, .Net). For Python, Guido appears to maintain primary control and he has done a wonderful job. The question is - someday, when Guido decides to step away completely - who or what controls the direction of the language and will it diverge much from Guido's current direction?  One link regarding the "no future Python 4" path is: No Python 4.
If you invest heavily in Python and something changes significantly (and quickly) then it could be very costly to change. At the same time, if a language looses popularity after its creator moves on then you may also be in a bad state.

The above coverage of Python is mainly targeted at CPython. The analysis for a different runtime, such as Jython, would need an independent review.  Performance, backing/maintenance and implementation details can be very different.

Another common language stack is NodeJS / JavaScript. It is often touted as high performance and has a large ecosystem of 3rd party libraries.  What aspects of this might affect the consideration for some software system?

Two item that comes up regularly for me are
  • The maturity of the 3rd party ecosystem. 
  • The expected lifetime of a system.
The problem I tend to run into is that there are many 3rd party libraries but the quality differs drastically and the long term support/maintenance of some frameworks is lacking. If you have a system which you expect to maintain for 5-10 years then you probably want to base it on technology which gets continued incremental maintenance over time.  Relying on unmaintained libraries and frameworks when security is important seems like a poor bet. You also don't want to do massive rewrites of a system every year because some new "great idea" arrived.  I've run into situations where core libraries used in NodeJS applications were abandoned by authors in favor of other completely different solutions.  I'd even agree with the authors decisions to abandon something which was no longer a good fit - but it isn't a good place to be in if you heavily rely on that software in a large or complex system.

Another popular language is Java - what are some considerations for it?
  • Speed of system implementation
  • Business domain for new system
Java is a good general language but it isn't normally considered as the first choice when "speed to market" is the most critical aspect. If you have a very limited time frame and no other requirements push you towards Java then another language may be more appropriate.  That is also true if your business domain is potentially in a scientific area where there are fewer 3rd party libraries available compared to a language such as Python. 

And if you have requirements which cross a number of these items resulting in no "perfect for this use" selection then you have hard decisions to make. 

This post could go on for many more examples and languages but hopefully provides a useful analysis for some of the challenges involved.

Wishing you the best!
Scott