Friday, March 7, 2014

Use KISS consciously

Ref: http://www.javacodegeeks.com/2014/03/use-kiss-consciously.html

A while ago I wrote about few design paradigms to keep in mind when designing and implementing a certain component. Among them, the famous K.I.S.S. (Keep It Simple, Stupid) kept on appearing as a valid and reasonable one. I then realized though how dangerous KISS can be when used by junior developers or, more generally, as a religion: it is pretended to be true and right, without further explanations, and hence in the name of KISS we get to justify almost everything. Often wrongly. The main concern is about what simplemeans in a certain context and whether that meaning breaks any other valid paradigm or, more precisely, your (technical) common sense.
We might probably apply the same reasoning to other paradigms as well, indeed correct design pattern and paradigms appliance always depends on the given contexts, but KISS seems to be a special case, because we can actually use it everywhere, anytime, in the name of simplifying things. But, are we really simplifying things?
Simple examples: in the name of KISS, a developer would prefer to have all business logic in one class (it’s simpler – you may hear – you don’t need to maintain several classes!); in the name of KISS, SQL select statement would all have the * fields selector (it’s simpler – they may say – you don’t need to list the seven required columns!); in the name of KISS… , and so on. Of course, I’m pushing it to a certain limit, but it’s clear that simpler doesn’t always mean better. As a consequence I become suspicious every time I hear someone claiming the appliance of KISS and here are a few valid points of debate, to spot a wrong KISS or at least to focus on its (mis)understanding in a certain context.

KISS may break other good practices

Is simple in conflict with other good practices? That’s probably the first and most important question. A simple solution should still be compatible with common Object Oriented practices, that is, it shouldn’t break for instance the Single Responsibility Principle (SRP) nor the Tell, Don’t Ask (TDA) practice; moreover, it should still ensure good testability (thus, simple to test as well, right?) while providing the expected behavior and functionality. Therefore when dealing with KISS try to compare (or reinforce) it against other well known practices and guidelines, defy it, don’t assume it right by the mere wonder of simplicity.

KISS may break performance

Does simple mean slow? Simplicity doesn’t always match with well performing and that could certainly be a red flag when KISS is in the air. Think about simple SQL queries which then perform poorly or simple algorithm implementations which then unnecessarily need an huge amount of memory or deployments which would not scale gracefully on the number of requests or users. We often cannot keep it simple and we would not be stupid indeed.

KISS may be quick and dirty

Does simple mean authorization to workarounds? You may still be conform to OO practices and provide reasonable performances, but in the name of KISS you could also add methods or parameters just because it would easily and quickly (and in a simple way) solve a certain issue. Right, nothing wrong with that as long as we are not introducing side effects or unexpected coupling, as long as we are not breaking contracts consistency or introducing unwanted future compatibility to keep, as long as we are also conform with the Principle of least astonishment (PLA), that is, not degrading user experience. Watch out hence as soon as simple means shortcut.

KISS may justify whatever solution

Does simple really make sense? As an overall rule, you may even doubt about how simplicity is intended to be applied in a given way and context and why should a certain simplicity be preferred over another. Yes, simplicity may have several faces and meanings, depending on final goal (what you really want to achieve, simple means you immediately see the solution), time (simple means you don’t have time for other solutions), constraints (simple means you don’t have other solutions), skills (simple means you don’t know other solutions). Moreover, when KISS is the only justification or advantage, try to seek at least a second one, don’t blindly trust purely KISS solutions.
As usual, our common sense and experience should guide use to the best choice, design patterns and paradigms are not silver bullets and should always be used consciously. Sure, simplicity is a great goal to achieve and an attribute worth to provide in terms of maintainability, readability, cleanness and yet elegance, but it should thus never mean less quality. You should hence mistrust KISS when it does smell like one of the scenarios above, because indeed its ambiguity may lead to the complete opposite outcome: complexity and troubles. It happens in real life as well, you might look for a KISS but you finally get a SLAP (Simplicity Leaving Awkward Problems).

Monday, January 13, 2014

Good interview questions

Ref: http://mashable.com/2014/01/10/hiring-experts-interview-questions/


Interviews are often stressful, but being prepared never hurts. Below, eight hiring experts share the questions they love to ask in interviews.

Who do you most admire and why?
— Michael Yormark, President, the Florida Panthers and Sunrise Sports & Entertainment
"The answer reveals a lot about who the candidate is, who she aspires to be, and whether she has the DNA to be part of a company's culture. It will also force the interviewee to make a decision between brutal honesty and telling the interviewer what she believes he wants to hear."

In your last employee review, what areas for improvement were identified?
— Andrew Shapin, Chief Executive Officer, Long Tall Sally
"When candidates are honest, it illuminates self-awareness and potential weaknesses. It also helps ensure I get the best out of them. The response can easily be verified with the previous employer. I also ask what progress has been made."

Why are you here?
— Andrew Alexander, President, Red Roof Inn
"I always ask this the minute a prospect sits down. After the initial shock wears off, I hope to hear a passion for the hospitality industry and a deep respect for customer service. I find this to be a tremendously effective way to gauge whether the person is interested in working for us or simply seeking a job."

So you're a Yankees fan. If you were their owner, how would you make the team better?
— Bonnie Zaben, Chief Operating Officer, AC Lion Recruiting
"I ask the applicant about their hobbies, and then we do role-play. I want to see how they think quickly and compose coherent presentations. Are they recommending specific player changes? Can they quote stats to back up a position? Can they present a cogent argument in five minutes without dead air? You'd be surprised."

What is your passion?
— Hilarie Bass, Co-president, Greenberg Traurig
"Passion leads to success. I have turned folks away who could not frankly answer this. The people attracted to us must show absolute commitment to the practice of law and solving clients' problems."

You're a project manager? Tell me about a time you had a delayed project.
— Susy Dunn, Vice President of People, Jama Software
"I always have a candidate provide a past situation similar to what they will encounter in a new position. The answer provides huge insights into their level of critical thinking, adaptability, awareness of their impact, and creativity."

Describe an environment in which you would not thrive.
— Larry Drebes, CEO, Janrain
"The candidate is less likely to have a scripted answer, and you see some on-the-spot introspection. You can learn a remarkable amount about personality, as well as cultural and organizational impact, which is hugely important. If this question is asked early in an interview, it often yields color for a richer conversation."

If you could do anything, what would be your ideal job?
— Liz Bingham, Partner, Ernst & Young
"A resume can tell you about their previous experience, but this question helps indicate the individual's passions and strengths and whether they're well-matched to the job. From aspirations in politics, to cafe ownership, to entrepreneurship, the answers are revealing."

Sunday, January 12, 2014

Friday, December 27, 2013

Top 10 Uses For A Message Queue


Ref: http://blog.iron.io/2012/12/top-10-uses-for-message-queue.html?spref=tw

We’ve been working with, building, and evangelising message queues for the last year, and it’s no secret that we think they’re awesome. We believe message queues are a vital component to any architecture or application, and here are ten reasons why:
  1. Decoupling It’s extremely difficult to predict, at the start of a project, what the future needs of the project will be. By introducing a layer in between processes, message queues create an implicit, data-based interface that both processes implement. This allows you to extend and modify these processes independently, by simply ensuring they adhere to the same interface requirements.
  2. Redundancy Sometimes processes fail when processing data. Unless that data is persisted, it’s lost forever. Queues mitigate this by persisting data until it has been fully processed. The put-get-delete paradigm, which many message queues use, requires a process to explicitly indicate that it has finished processing a message before the message is removed from the queue, ensuring your data is kept safe until you’re done with it.
  3. Scalability Because message queues decouple your processes, it’s easy to scale up the rate with which messages are added to the queue or processed; simply add another process. No code needs to be changed, no configurations need to be tweaked. Scaling is as simple as adding more power.
  4. Elasticity & Spikability When your application hits the front page of Hacker News, you’re going to see unusual levels of traffic. Your application needs to be able to keep functioning with this increased load, but the traffic is anomaly, not the standard; it’s wasteful to have enough resources on standby to handle these spikes. Message queues will allow beleaguered components to struggle through the increased load, instead of getting overloaded with requests and failing completely. Check out our Spikability blog post for more information about this.
  5. Resiliency When part of your architecture fails, it doesn’t need to take the entire system down with it. Message queues decouple processes, so if a process that is processing messages from the queue fails, messages can still be added to the queue to be processed when the system recovers. This ability to accept requests that will be retried or processed at a later date is often the difference between an inconvenienced customer and a frustrated customer.
  6. Delivery Guarantees
    The redundancy provided by message queues guarantees that a message will be processed eventually, so long as a process is reading the queue. On top of that, IronMQ provides an only-delivered-once guarantee. No matter how many processes are pulling data from the queue, each message will only be processed a single time. This is made possible because retrieving a message "reserves" that message, temporarily removing it from the queue. Unless the client specifically states that it's finished with that message, the message will be placed back on the queue to be processed after a configurable amount of time.
  7. Ordering Guarantees
    In a lot of situations, the order with which data is processed is important. Message queues are inherently ordered, and capable of providing guarantees that data will be processed in a specific order. IronMQ guarantees that messages will be processed using FIFO (first in, first out), so the order in which messages are placed on a queue is the order in which they'll be retrieved from it.
  8. Buffering In any non-trivial system, there are going to be components that require different processing times. For example, it takes less time to upload an image than it does to apply a filter to it. Message queues help these tasks operate at peak efficiency by offering a buffer layer--the process writing to the queue can write as fast as it’s able to, instead of being constrained by the readiness of the process reading from the queue. This buffer helps control and optimise the speed with which data flows through your system.
  9. Understanding Data Flow
    In a distributed system, getting an overall sense of how long user actions take to complete and why is a huge problem. Message queues, through the rate with which they are processed, help to easily identify under-performing processes or areas where the data flow is not optimal.
  10. Asynchronous Communication
    A lot of times, you don’t want to or need to process a message immediately. Message queues enable asynchronous processing, which allows you to put a message on the queue without processing it immediately. Queue up as many messages as you like, then process them at your leisure.
We believe these ten reasons make queues the best form of communication between processes or applications. We’ve spent a year building and learning from IronMQ, and our customers are doing amazing things with message queues. Queues are the key to the powerful, distributed applications that can leverage all the power that the cloud has to offer.

How To Successfully Build Team Confidence


Ref: http://java.dzone.com/articles/how-successfully-build-team

In software development, building a great team is a delicate yet achievable goal. Although there isn't an exact formula, most managers would come to a common consensus on the basics. The formula might look something like this: Varying Skill Sets + Seasoned Members + Balanced Personalities + Proper Mindset = Success! Many attempt to build teams with this or similar formulas but find that some teams still struggle to shine. This is generally due to a lack of team confidence. Although each member might be an all-star on their own, when placed on a team, the team itself has its own personality. A team with confidence issues is dangerous and typically results in disorganization, frustration, mistrust, unhealthy debate, buggy releases, and missed deadlines. The good news is there's a simple way to build team confidence.
Team confidence can be achieved through delegation. This is not in reference to the programming "delegation" design pattern. This concept has been around much longer than modern technology. Good old fashion delegation is "the partnership of authority ... to carry out specific activities." After reading this section, there might be some skeptics out there. That's okay; skepticism is good (check out Skepticism: A Developer's Sixth Sense). Let's break down the results of this simple, yet very effective, tool:
Acquiring New Skills
Sometimes building or attaining new skills will be necessary to delegate tasks. When this happens it's a win-win scenario. This helps team members try new things, advance within their job, and grow within their career. Adding skills can also increase the self esteem of team members.
Expanding Team Value
As team members achieve new skills and delegate work throughout the group, the overall team's value increases. Furthermore, this encourages the growth of tribal knowledge within a team. This helps limit the impact of team members who are promoted, moved to other teams, or leave a company.
Empowering Members
Delegation is an opportunity to empower others. Empowering team members provides an opportunity for team members to assume more responsibility. Additionally, empowerment is a sign of trust and confidence in a member's ability to manage a task on their own.
Building Trust
Trust is always an important attribute of any successful team. Trust cannot be taken; it must be given. Delegating different types of jobs to team members will require them to work with each other. This will naturally lend itself to opportunities where trust can be built between team members.
Allowing Skills To Shine
Some developers are natural public speakers (there are a few); others might be excellent organizers. Delegation provides an opportunity to display additional skills that might not be part of daily programming life. Providing this avenue can be invaluable for retaining seasoned team members.
Increasing Efficiency
Delegating work load will increase a team's efficiency. Sometimes this impact will be immediate, while other times (in the case of learning new skills) the team will receive benefits in the long-term. Additionally, as confidence grows, teams will seek out ways to become more efficient.

Although team confidence might be the goal of delegation, its results are far reaching. Delegating work is a guaranteed way to increase team satisfaction, properly motivate members, and help prevent team burnout. Sometimes the fast-paced nature of technology can blind people to only look forward for new ideas and approaches. Sometimes good ideas or approaches such as delegation already exist and simply need to be properly executed.

Friday, December 13, 2013

5 Factors that Contribute to Employee Disengagement

Ref: http://java.dzone.com/articles/5-factors-contribute-employee-0


It is a fact that some employees feel less excited or emotionally responsive toward their job. Employee disengagement occurs due to a number of reasons and it is important for managers to be aware of these factors to improve their employees’ attitude and ensure productivity. Here are some of the common reasons why people experience negative feelings about their work.
1. Misled about the nature of the job
One of the causes of employee disengagement is when people are being misled about the kind of job and position that are offered to them. For instance, they are given a different idea about their workload, job responsibilities and schedule, which was not what they were expecting during the interview process. Thus, transparency is important, so employees will not feel forced to work on a job that will not give them satisfaction. 
2. Incompetency for the job position 
There are instances that a person is hired for a job because there is a great need to fill a specific position. However, as time goes by, employees may feel misplaced and incompetent since they are placed in a position that is not suitable for them. When this happens, they will end up disliking their job and become more of a burden than an asset to the company. 
3. Poor training and harsh feedback
Companies that fail to provide proper training to new employees, can lead to employee disengagement. Moreover, lack of training will have a direct impact on the quality of work that employees provide, particularly when this is coupled by the absence of motivation and support from managers. Eventually, their disappointments and frustrations will cause them to quit and leave their job.
4. No opportunities for advancement
Every employee dreams of being promoted or advanced to their chosen career. Hence, when they look for a job, they prefer to be employed in a company that can provide them with a promising future. If the company does not offer such opportunities for advancement, employees are less likely to stay for a longer period, and they will not be quite productive or efficient at work.
5. Lack of recognition
Employees long for a sense of recognition or appreciation for every good thing that they do. If employees do not receive any incentives in spite of their efforts to help an organization achieve its goals, they will eventually decide to transfer to another job. With this in mind, a reward system should be set in place to encourage employees to do even better and stay longer in a company.
By being aware of their common reasons for employee disengagement, companies will be able to retain their competent employees and ensure the success of the entire organization on a long-term basis.

Thursday, November 14, 2013

Common methods used for internet censorship

Ref: http://www.techgig.com/tech-news/editors-pick/How-to-bypass-internet-censorship-20363



IP Blocking

This is the most basic method used to filter content. It involves blocking the IP address of the target website. Unfortunately,websites sharing the same IP address, which is usually the case on a shared hosting server, are also blocked. This was the method used by ISPs in the UK to block The Pirate BayWorkaround:you need is a proxy with access to the blocked site. There are numerous free proxies online. This article by Guy McDowell lists four sites that give you a free updated proxy list. The proxy server fetches the website for you and displays it on your browser. Your ISP only sees the IP address of the proxy and not the blocked website. Blocked websites can also beat this censorship method by adding a new IP address and letting users know about it. Users are then able to access the site without any problems.

DNS filtering and redirection
This is a much more sophisticated filtering methodthe Domain Name Server (DNS) fails to resolve the correct domain or returns an incorrect IP address. ISPs in many countries use this method to block illegal sites, for example, Denmark and Norway use DNS filtering to block child porn websites. China and Iran have also used this method numerous times in the past to block access to legitimate sites. Read Danny's article on how to change your DNS for more in-depth information.

Workaround: One way to circumvent this is to find a DNS that resolves the domain name correctly, for example, OpenDNS or Google Public DNS. To change your DNSyour ISP to OpenDNS or Google Public DNS, you must configure it in your operating system or device. Both have excellent tutorials fortypes of operating systems. You can also type the numeric IP address in your URL bar instead of the actual domain name though this is less effective especiallysites share IP addresses.

URL filtering
With URL filtering, the requested URL is scanned for targeted keywords irrespective of the actual domain name typed in the URL. Many popular content control software and filters use this method. Typical users include educational institutions, private companies and government offices.

Workaround: A highly technical method to circumvent this is to use escapeacters in the URL. However, it is much simpler to use encrypted protocols such as a Virtual Private Network (VPN) service or Tor. Once the data is encrypted, the filter cannot scan the URL and you can therefore access any website.

Packet filtering
This method is also known as static packet filtering. It is a firewall technique used to control network access. Incoming and outgoing data packets are monitored and either stopped or allowed through based on pre-determined rules such as source and destination IP addresses, keywords and ports. When used in internet censorship, TCP packet transmissions are terminated by the ISP when targeted keywords are detected.

Workaround: Again, VPN services and Tor are the best ways to get around packet filtering. Packets sent over VPN and Tor contain dual IP headers. Firewalls are only able to apply the filtering rules to the outer header but not the inner header when these data packets are transmitted.

Man-in-the-middle (MITM) attack
I have only heard of this method being used by some of the regimes I mentioned earlier. It is a common hacking method, but in January 2010, Chinese authorities successfully used a MITM attack to intercept and track traffic to Github.com. As the name implies, an MITM attack is based on impersonation,the eavesdropper makes independent connections with the victims and makes them believe they are communicating with one another.

Workaround: The best defense against MITM attacks is to use encrypted network connections, such as offered by HTTPS (what is HTTPS?) and VPN. HTTPS utilizes SSL capabilities in your browser to conceal your network trafficsnooping eyes. There are Chrome and Firefox extensions known as HTTPS Everywhere, that encrypts your communication on most major sites. When browsing on HTTPS, always take note of any browser warnings to the effect that a website's certificate is not trusted. This could indicate a potential MITM attack. VPN and Tor technology also uses SSL, which forces the attacker to obtain the key used to encrypt the traffic.

TCP connection resets/forged TCP resets
In this method, when a TCP connection is blocked by an existing filter,subsequent connection attempts are also blocked. It is also possible for other users or websites to be blocked, if network traffic is routed via the location of the block. TCP connection resets were originally used by hackers to create a DOS (Denial of Service) condition, but Internet censors in many countries are increasingly finding the technique useful to prevent access to specific sites. In late 2007, it was reported that Comcast used this method to disable peer-to-peer communication. The US FCC ordered Comcast to terminate the practice in August 2008.Workaround: The workaround for this mainly involves ignoring the reset packet transmitted by the firewall. Ignoring resets can be accomplished by applying simple firewall rules to your router, operating system or antivirus firewall. Configure your firewall to ignore the reset packet so that no further action or response is taken on that packet. You can take this a step further by examining the Time-to-live (TTL) values in the reset packets to establish if they are cominga censorship device. Internet users in China have successfully used this workaround to beat the Great Firewall of China.

Deep Packet Inspection (DPI)
Now this one is really scary. Under the wings of the PRISM project, the NSA used this method to eavesdrop and read private email communications. China and Iran use deep packet inspection for both eavesdropping and Internet censorship. DPI technology allows prying eyes to examine the data part of a packet to search for non-compliance against pre-determined criteria. These could be keywords, a targeted email address, IP address or a telephone number in the case of VoIP. While DPI was originally used to defend against spam, viruses and system intrusion, it is clearrecent developments that it is a now a weapon of choice for Internet censorship.

Workaround: To beat a Deep Packet Inspection, you need to connect to a remote server using a secure VPN link. The Tor Browser bundle is ideal to evade deep packet inspection because it conceals your location or usageanyone carrying out network surveillance or traffic analysis.