The Artistic Way of Programming

12 years back, when I started my formal classes in computer science, the first thing I learnt was “data” means “information”. A few days after that, we started conventional programming, where code and data were treated separately. For example, only data can be passed as the functional arguments. It was difficult for me to digest that “code, which is also information, is not treated as data”. I strongly felt that this will increase complexity of softwares in the long run.

A system does three things – read, transform (processing data), write. In other words – the mathematics (the transform part), and the effect of that in real life (the read/write part). The data transformation is indeed a mathematical concept, and with the help of read and write we make the mathematics (the transform part) useful to the real world. Bringing the “transform” part fully inside mathematical domain has its own benefit of using mathematics without fear (possible errors) for the analysis of the system, making the system more tractable mathematically. The catch is to treat both the elements of transformations, data and functions, equally.

Initially, code used to be bigger than the data, so sending data over the wire was feasible. But with time, data becoming huge, sending code to systems over the wire becomes the need, resting the data on the systems intact. With big data, the need of the hour is to treat the code as data, so that the code can be taken as argument to another meta function on a system having huge data which expects an algorithm for transformations.

Roughly speaking, codes are algorithms, algorithms are mathematical functions, functions are in turn actually look-up tables, i.e. data. Hence with this principle, all codes or functions are data.This is exactly the cornerstone of the functional paradigm. The functional programming is programming with functions, they treat functions and data likewise. Another principle I love, to control complexity, rules should not be complex itself.

Thumb rules rewritten for the functional paradigm:

Read-write and transformations(algorithms) should be separate.
Use immutable variables. Discourage use of reassignment statements.
Discourage side-effects (input/output or changing any variable in-place), every function should ONLY return its expected result.
Use referentially transparent functions (sometimes it is called pure functions) with no side effects, i.e. if x = y, f(x) and f(y) should be same forever.
Unit testing is a must for each function.
One of the main design patterns should be followed is to use expressions instead of instructions, i.e. it should be declarative in nature. Discourage use of loops like for/while – use recursive statements as shown above to calculate sum. Tell computers what needs to be done, not how to do it – it reduces error, especially edge cases.
With the need to control the complexity of the system and the advance design, the design pattern for the functional composition can be made to follow some basic algebraic structures, which in turn becomes more robust.

Posted in Uncategorized | Comments Off on The Artistic Way of Programming

The Last Chance for Gold

Growing up in my corner of Florida, there used to be an old gas station on the edge of the Everglades. The proprietor did a lot of business with his oversized, hand-painted warning sign:

Last Chance for Gas.

Beyond the fuel pumps were a thin two-lane ribbon of asphalt and 90 miles of swampy wilderness. No smartphones. No “emergency call boxes.” And, in most places along the highway, no guardrails either.

You were on your own – much like the economic wilderness we’re all forced to navigate today.

Which is why the sharp decline in gold prices and mining stocks is much like that warning sign… and a monetary gift…

In short, if you were waiting on the sidelines after this year’s monster rally, this is your second chance – and, in my view, your last chance – to buy gold at these prices. And it comes at just the right time. Typical Moves for Gold

Gold’s done a full round trip in buyer sentiment during the past 12 months: from being the world’s “most hated commodity” at its lows near $1,050 an ounce 12 months ago to “gotta buy it” status at $1,350 an ounce this summer.

With gold now fallen from those lofty heights, an investor is more likely to ask: “Gold, what have you done for me lately?”

In all, gold’s given back about 60% of its 2017 rally. Yet such sharp declines followed by a resumption of a broader trend higher is a typical early bull market move for this volatile metal. Most famous of these pullbacks was gold’s run to all-time highs in the 1970s.

Starting out at $35 an ounce in the early ’70s, as gold became legal for Americans to own once again, bullion prices soared to almost $190 an ounce in 1975. That’s quite a run all on its own. During the next 18 months, gold prices dropped back nearly 60%, falling to $100 before running to a then-record $800 an ounce in the next three and a half years.

The Song Remains the Same

Most important, when it comes to the companies that dig this stuff out of the ground… nothing has changed.

As I have pointed out in past months, gold mining firms have done a great job getting their costs down and making money to boot.

We noted as early as February that the elite companies in this group were making an average of $215 for every ounce of gold they were digging out of the ground and said, in no uncertain terms, to anyone who’d listen: “Stop panic selling gold mining stocks. Likewise, after cutting dividends in 2014 and 2015 as gold prices plummeted, many of the same companies have not only reinstituted payouts, they’ve started raising them again. In the meantime, mining firms have cleared away much of their old cost structures. That’s why Newmont Mining, as one example, has been able to drop its “AISC” – all-in sustaining costs – from $1,170 in 2012 to $910 so far in 2016.

The point is that there are many reasons to own gold: for speculative profits, as discussed above; for insurance; and for wealth preservation. But you can’t benefit from any of those strategies without taking advantage of the gift that is low gold prices and low expectations put on our table by Wall Street’s hair-trigger traders.

Posted in Uncategorized | Comments Off on The Last Chance for Gold

5 New Year’s Resolutions for Busy Families

It somehow seems that modern life is busier than it has ever been. As well as our work and family commitments, there are now so many ways to spend our leisure time; it often feels like 24 hours is simply not long enough to get everything you wanted done in the day.

The problem of being busy all of the time (even though it is a good problem to have) hits those of us who have time-consuming jobs and are also raising a family the hardest. If you fall into this category, you may find it helpful to read the following list of five potential New Year’s resolutions you could make to ensure your 2017 is less stressful than this year may have been!

1) Leave the office on time – Even if it’s only on one or two days a week, it is important that you sometimes put your foot down and leave your place of work as soon as your day is meant to finish. You’ll find that you get much more done in the evenings!

2) Invest in a 2017 calendar – It may sound like a simple step, but that’s sort of the point. Having your work and leisure commitments mapped out for the weeks and months ahead in an easy to view format will allow you to see at a glance just how busy you are and whether you are taking on too much.

3) Spend 10 minutes doing nothing – Again, this is more productive than it sounds! Set your alarm ten minutes earlier every day so that, before you get up, you can spend this extra time in completely undisturbed silence, thinking about what your priorities should be for the day to come.

4) What are your two most important tasks? – Speaking of priorities, it is also a good idea to take a step back from time to time and decide which the two most important jobs are that you wish to accomplish on any given day. This is a great way of clearing your head when you feel overwhelmed.

5) Consider hiring household staff – You may have thought that hiring a nanny or other household staff might be the ‘easy way out’, but this is not the case. Those who have invested in professional assistance of this kind know that hiring a caring and responsible person to help run your busy home is a fantastic way of relieving domestic pressures.

Posted in Uncategorized | Comments Off on 5 New Year’s Resolutions for Busy Families

Things To Do When Waiting For Exam Results

After your exams, you binge on caffeine, spend sleepless nights and bear a lot of stress. Well, it happens, especially when the result day is close. At times, the stress you have after exams is far intense than the stress you have during exams. There is no doubt that coping with this stress is difficult, but the tips below can help you keep the anxiety at arm’s length.

Move on

No matter what you do, you can’t go back in time to make changes. What is done is done. There is no use of comparing the answers. As a matter fact, doing so will do nothing except adding to your level of anxiety. So, take your time and move on.

Stay away from online forums

After your exams, stay away from online forums until the result announcement day. Although these forums are great places to spend time on, you shouldn’t go there just to see what others have to say about their performance in the exams. Reading the remarks of others about the exams on these online platforms may intensify your stress. Don’t sit idle

What you need to do is keep yourself busy. In other words, if you keep yourself occupied, your mind won’t pay attention to the result day. For instance, you can get a job or join a gym to keep yourself occupied. You can also start a hobby, such as gardening or photography.

Talk to a Friend

Spend time with your close friend and share your worries with them. Keeping it to yourself will only increase your depression. What you need to do is let your worries come out gradually at a certain pace rather than growing it inside you.

Write your worries on paper

In your free time, write you worries down on a piece of paper and then burn it down. While it seems odd, this technique will work wonders and you will feel better.

Sleep Well

Sleeping well is necessary if you want to stay fit both mentally and physically. It will also improve your quality of life. Ideally, you may want to get at least 8 hours of sleep in 24 hours.

Don’t drink

Alcohol can’t help you to stay happy. Instead, you should eat something healthy. You can drink milk or fruit juice, for instance. Be positive

Why should you be optimistic? Well, the biggest benefit of being positive is that it will help you lower your stress level. And this will help you deal with the stress on the result day. The least you can do is smile at others whenever you meet them. According to scientists, when you smile, you release a chemical known as endorphine. The stress hormone called Cortisol is also reduced. Therefore, you can get rid of stress by smiling.

In short, you will find these tips helpful. Keep in mind that stress will have a bad impact on your health. To stay in good shape, what you need to do is keep yourself busy, eat healthy and smile at others.

Posted in Uncategorized | Comments Off on Things To Do When Waiting For Exam Results

Stay Healthy and Wealthy

When you make those New Year’s resolutions, you’re thinking about fresh starts and the year ahead. What you might not realize is that some resolutions also could save money. Here are some popular resolutions that could help get you and your finances in shape in 2017.

Quit smoking: You can save money by stopping a pack-a-day habit, which can cost between $1,825 and $3,650 per year, depending on the cost of cigarettes in your area. Nationally, a pack-a-day smoker is going to spend an average of $2,000 annually on cigarette costs.

Set up and stick to a realistic budget: If you want to resolve to stick to a budget in 2017, you must start with a realistic plan. People tend to make financial resolutions the same way they do a weight loss plan. If you start with lofty goals they will be unachievable within a month. List your priorities for spending rather than restricting your spending. Focus on necessary expenses then include a certain amount for retirement savings. Then with the remaining money you have each month, set aside a little for enjoyment. It’s critical you have rewards in your budget.

Exercise regularly: You’ll save money in several ways with regular exercise. On average, Americans are spending $7,800 annually on health care, according to the National Association of Health Underwriters. But exercise brings real savings. “If people are eating right and exercising three times a week for 20 minutes a day, they see prescription costs decrease by 70 percent and medical costs decrease by 30 percent,” says Ric Edelman of Edelman Financial Services. Stop spending money recklessly: One of the best ways to stop spending your money recklessly is to track where it is going each month. Check with your credit union and download their free mobile budgeting app that shows expenditures by category so you can monitor your spending. A great way to get your spending under control is quit trying to “keep up with the Joneses”. If you want to fix your bad spending habits in 2017 start hanging out with other spendthrifts because you will likely become one yourself.

Eat healthier: A healthy eating plan can be as — or more — economical than fast food. It’s a total myth that eating healthy is expensive. Buy smaller but leaner cuts of meat, eat protein-rich beans and buy produce in season when it’s freshest and least expensive. A smaller amount of a leaner cut can slice your food bill and your bad cholesterol.

Build an emergency fund: Nothing takes the stress out of financial situation like spare cash. If you are among the millions of Americans that don’t have enough money set aside to cover unexpected expenses or emergencies, then you should resolve to build one in 2017. Experts recommend putting enough money in a savings account to cover six months’ worth of expenses in case of unexpected emergencies like job loss, maternity leave or medical issues. You can always apply a small amount of your paycheck towards this account, so you make sure it is hidden from you.

Pay off high-interest debt: Paying down credit card debt is one of the most popular short-term goals in 2017. Try focusing on paying off your high-interest credit card debt before other debts because it is more expensive. And, it you are motivated by seeing those results first hand, start by paying off your card with the lowest balance first so you can feel that sense of accomplishment. Create your estate plan: An important 2017 resolution would be to tie up any financial loose ends for your loved ones so they aren’t left trying to pick up the pieces. Make sure you have a will or trust that designates who’s in control of your assets. You certainly don’t want the state court system to make that decision for you. Don’t forget to designate a guardian for your children, and someone who will make financial and healthcare decisions for you if you are unable to do so.

Develop common financial goals with your partner: Many times finances are the biggest source of conflict between couples. It’s important that couples sit down and create a financial plan. It doesn’t usually work to try and manage their finances separately.

Any of these resolutions can help improve your financial security in 2017. I suggest tackling one financial tip each month so you don’t get overwhelmed. Then as you get accustomed to the new approach to spending and saving, add another. By the time 2017 starts dwindling toward 2018, you will find you’ve made progress on achieving your financial goals.

Posted in Uncategorized | Comments Off on Stay Healthy and Wealthy