quarta-feira, 17 de maio de 2017

Preparing for Your next Job - Software Engineering and Managament


While preparing for interviews for Amazon, Facebook and Google i came across a lot of resources. So here is a little collection that worked for me and some thoughts :)


First Steps

Do you know what you want/makes you happy on your next job? 
Draft a Wish list, this will help you position yourself. For me, for examples somethings always make the top: Work with Smart people, High availability and Big Scale, Being valued, TRAVELLING... and so on.

Do you know where you would like to be at within 2 years? .. and within 5 years?
This is important, you might not know or even care as all you can think of is: i just want to get a job. Why is it important? At a personal level goals change all the time and you might get it wrong but that is ok, use agile and re adapt. Makes it easy for you and for a company trying to hire you if you have some idea of where you want to be (.. even if it changes in a month). Another aspect of this is that this will help you structure your questions and understand if a particular company has the path you want. For me it's always important that the company has a easy way to swap teams or even job family because i know that after a while i will want it. I have been a Software Manager for the past 4 years (almost) and although i want to maintain myself technical I also want to learn how to manage managers. I have done it only once and for a brief time and i know i have made a lot of mistakes, will this new company help me grow on this area? Will i have the opportunity to work with peers that will mentor me and have a manager that will groom me towards it?
Also important for me is the opportunity to learn new skills, I want to learn more about Machine Learning, might not even be within the scope of my team but still.. Again i will ask if this company will give me this opportunity.
I don't know which position you are applying for or which company but whatever it is i am sure you can make this mental revision and if you can't you can always put down: Will this environment/company will help me define my path and understand better what i like? This can translate into a good career management and flexibility to try out new things so you can discover passions.

Structure your study
Well as in anything you need a bit of discipline or procrastination will creep in and you will tend to go and do exercises you feel comfortable with or re read things you already know.. and then you end up just watching another episode of Big Bang Theory :D
Here is a list of things you should master if this is a software engineer position:


Technical (this fits a generic Software engineer Role)

This is what is normally expected of a mid-senior engineer and covers coding and also Algorithms and Data Structures questions.


  • Be familiar with at least one language. What does this mean? You should know most of the typical api's (e.g. in Java if I want to use Iterator i should know the interface)
  • Object Orientated Design and Programming. Make it SOLID and know Design Patterns :). If you are not comfortable take a look into the Read section. A Really good book would be GangOfFour but might be easier to go through some of the videos on youtube (e.g. Code Walks).
  • Testing. More than any fancy framework/library you should be well versed on what edge cases are necessary (e.g. test empy, max, min, duplicates, etc)
  • Algorithms. ​Know how to approach the problem with bottom-up and the top-down algorithms. You should know the complexity of an algorithm and how you can improve/change it. tipycal algorithms that are used to solve problems include: sorting (plus searching and binary search), divide-and-conquer, dynamic programming/memoization, greediness, recursion or algorithms linked to a specific data structure.
  • Know Big-O notations (e.g. run time, space) and be ready to discuss standard, well established algorithms. You may wish to discuss or use bullets to outline the algorithm you have in mind before writing code. Love this Big-O Cheat Sheet, memorising is not the answer but this helps pin point when you look into an algorithm.
  • Sorting: ​Be familiar with common sorting functions and on what kind of input data they’re efficient on or not. Think about efficiency means in terms of runtime and space used. For example, in exceptional cases insertion-sort or radix-sort are much better than the generic QuickSort/MergeSort/HeapSort answers.
  • Data structures: Study up on as many other structures and algorithms as possible. Read about the most famous classes of NP-complete problems. You will also need to know about trees, basic tree construction, traversal and manipulation algorithms, hash tables, stacks, arrays, linked lists, priority queues, and when they are appropriate.
  • Recursion​: Many coding problems involve thinking recursively and potentially coding a recursive solution. Prepare for recursion—which can sometimes be tricky if not approached properly. Use recursion to find more elegant solutions to problems that can be solved iteratively.
  • Mathematics​: Some interviewers ask basic discrete math questions. Spend some time before the interview refreshing your memory on (or teaching yourself) the essentials of elementary probability theory and combinatorics. You should be familiar with n-choose-k problems and their ilk.
  • Scale & Design
    • On Coding - does your algorithm/DS scale if it's used by 1 billion users? You should be able to adapt and flush stored memory according to the given scale or at least walk the interviewer through the thought process of it

    • On Systems - At least for me this one comes with experience and as a mash up of a lot of things and becomes intuitive. But good designs follow some principles and you should know them. Here is a good lecture :)

Management/Leadership

Different companies have different management styles and expectations but all off them will cover Performance Management, Work frameworks(Scrum, Kaban, etc) and Career Development.
Google, Facebook and Amazon will focus on team delivery from different perspectives. Google will focus on Impact either internally or externally. Facebook approaches things on building fast and failing fast again the Delivery is important. Amazon likes to Deliver Results and focus on customer impact, this is very important if you want a job at Amazon, make sure you know all Leadership Principles



Before jumping to practice learn from who has done "zillions" of interview.. Read this to get you in the mood!
http://steve-yegge.blogspot.co.uk/2008/03/get-that-job-at-google.html


Read 

Image result for read meme funny

Job Descriptions

  • Read your Job description :) Identify what you feel and don't feel comfortable with, map it and try to mitigate it.. or just be honest about it with the recruiter to understand if it's ok to have those gaps. I applied to SRM and i was very honest that my strength is in Software Engineering and not so much on infrastructure, it would be impossible for me to learn it in a couple of weeks and that was fine.
Books


Online Resources and Examples


Practice!

Coding

Some tips for your coding interview:
  1. Be prepared for technical questions involving coding algorithms and data structures. Normally you can code in any language you wish.
  2. Consider things like memory constraints, the complexity of the algorithm you are writing (and its running time O(N^2) to O(N) etc.) and how your solution can be improved and optimised. 
  3. Produce clean, efficient code in a reasonable amount of time and be able to optimise your solution. You should also check for edge cases and test your code to ensure it is as bug free as possible.
  4. It may help to review core CS concepts (data structures, binary trees, linked lists, object oriented analysis/design, design patterns etc.) as well as subjects pertaining to the scale of our environment.
  5. Always make sure you understand your input/output as it might be key to your problem solving: if it's a string what charset is it, what encoding,; if it's a number is it an integer, can it go bellow zero and so on;  is it a set?
  6. It is recommended to practice solving problems on a whiteboard or a piece of paper in front of a friend who can help you spot bugs and so you're comfortable problem solving out loud - Always start with the top left corner and test your pens hehehehe.


Design

Designing solutions for very large scale distributed system/sub-system (think of scalability, data centers, network latency, redundancy, concurrent users, etc.) With this interview, thinking of scale is KEY. also try and think of the most optimal design and trade-off. Be sure to ask clarifying questions, suggest alternatives, and propose better solution. It may be helpful to think of it as a technical discussion with a colleague where the objective is to come up with a design document for a new system. Refresh your knowledge or learn about *numbers and orders of magnitude of Internet, computers and networks*. That means for instance to have some basic ideas about number of internet users, the time they spent on internet, size of network packets. RTT on Internet... and also about time taken for various basic computer operations (cpu cache access, memory access, disk access, network data transfer etc. Knowing how things work from the outside is not enough, you have to understand how they have been implemented (and better why it is this way!). Review your existing knowledge from that perspective. For example, don't think you know map/reduce if you don't know what in-memory and on-disk data structures are used, how data are transferred and what are the tradeoffs made in some map/reduce implementation Be ready to quickly do back-of-the-envelope estimates. You may want to play some estimate games (search fermi problems) to be at ease with that.

Some example questions are: Design a key-value store Design Google search
Architect a world-wide video distribution system Build Facebook chat
Build Instagram
They may focus on some machine learning, networking system, iOS or JavaScript if you have that domain expertise on your resume. They don't expect you to know crazy algorithms that you likely wouldn’t know off the top of your head (like quadtrees or Paxos). The emphasis is on how you perceive the system and problem space.
Make sure you understand concepts like sharding, fan-out, partitioning, batching, queuing, etc

Some tips on how to tackle it:

  • Write down all use cases, make sure you understand what is expected of this system you are designing
  • Write down the dimension of the problem, if there are inputs what are the size, how many per second, what is the format.
  • Is it global? Ask if you need data consistency or if it can be eventually consistent. Ask if you need to have security considerations?
  • What are you optimising for on each use case?
  • Remember single responsibility? Still applies so if you have the use cases start expanding from those. Example: I need something that parses a log so you have a component Parser :)
  • Get a simplistic design make sure you understand the problem. Do not get into rabbit holes and get stuck in a specific component before having solved a working solution.
  • Once you have a working solution.. Scale it to the size of the problem, be concrete. At Amazon they won't give you what kind of machine you have available but you can still check the dimension of the problem and go through it. At Google they give you specific numbers.  This is almost like TDD, while sizing you will re-adapt your solution. Might not be feasible to have 6 TB of Data in Memory. 
  • Pay attention on single points of failure and how to cope with it. Your system needs to be reliable.
  • Trade Offs: creating duplicate data might be worthwhile depending on what are you optimising for. I always remember the twitter architecture example
  • Create redundancy.
  • Some interviews expect you to calculate how many machines will you need according to the specification as the ultimate result of the interview but i only got that at Google.


Management and Leadership


Slightly more complicated to practice but a good idea would be to go through examples that you went through and if you haven't try to role play scenarios.
You should have examples of: Bad Performance Management, Developing your Engineers, Conflict Management inside and outside the team, Change Management, Strategy Thinking: how to build a road map and challenges, Influence: How to influence Peers and Upper Leadership. How do you balance and negotiate priorities with stakeholders.


You will be given scenario like questions and can range on anything from performance management (example: you have a strong engineer underperforming, how do you get them back on track) or conflict resolution (example: designing a fair on-call rotation or you have two engineers who are conflicting with each other, how do you resolve it). You should always be thinking of retention for the staff and motivating them back to full effectiveness.
The questions will feel short but feel free to go in-depth for your answers while giving examples however it's important to stay on point as well.

At Amazon the questions will be  less scenario driven and more example driven: Tell me about a time when you had someone on your team performing bad? These are still the same topics just approached on a slightly different manner. Facebook also goes more into actual examples then scenarios. 

A Manager will also need to know about project management, normally this goes a lot into Agile methodologies but be expected to know how to react to waterfall and how do you plan accordingly. What metrics do you use on your team? Velocity? How do you use velocity? How do you estimate with the team?  Tell me about a time when upper management gave you a date and a project to deliver and how did you went about it given that the time constraint was critical?

Some things you have learned intuitively so try to list down all the steps taken and read best practices on each topic.


Day 2 Day knowledge
Regardless of the interviews there are some day to day things you should know... if you don't.. pick it up pick, it up!


A bit Before and On the day of the interview:

-- Before -- (day - 1)
Learn about the Company
Create a list on why would you want to work for this company.
Learn about the company and be a stalker, go the the linkedIn profiles of the interviewers, it will give you some insight on what
Overcome Impostor Syndrome

Listen/Read to what impostor syndrome is, how normal it is and just dismiss it:
https://blog.valbonne-consulting.com/2014/08/16/the-imposter-syndrome-in-software-development/
https://www.laserfiche.com/simplicity/shut-up-imposter-syndrome-i-can-too-program/

Sleep well!
Wake up early, do your morning routine without thinking too much about the interview.. just relax, put on some music, whatever makes you happy. (for me always includes expresso :D).

-- On the Day --
Start your engine! Before I go, I usually start the engine.. what do I mean by this.. your brain needs a kick to get it running. If i have interviews that require coding, typically, i get one of the easy coding exercises from leetcode, for example: https://leetcode.com/problems/valid-anagram/#/description and just smash it!
There is always commute time and you can make the best out of this time. Calm yourself and be confident of your skills, you know you know it. Review some things mentally and most and foremost Have Fun on your interview.

During the interviews. Take your time to understand the exercise, do as many questions as you want, whatever pops into your head just ask. There are no silly questions, don't be afraid of failure, not asking the question can be what trips you over and then you will regret not having done the question.
WRITE everything down. While you write your brain assimilates on a different level, even the smallest things. I create a little corner on the write board where i write all assumptions, my own doubts and answers. I also create a little corner for test cases.
Instead of speaking to yourself, speak out your thoughts, the interviewer won't interrupt you and it will be easier for him to follow where you are going.  The interviewer was in your position once and he is now in the other side, this will make him nervous as for him it's a huge responsibility to evaluate you, empathise with him/her, he is on your side.

A good thing to keep in mind is: FAILURE == NOT TRYING. Most people don't even try to change  jobs and are too afraid of being rejected. You got yourself this far, that is already success, if you are not accepted remember you tried, you are a step closer and you can always try again. The amount of false positives is really high and all companies know that. I know a lot of people that made it to Amazon after 2 attempts the same with Google and Facebook.
I have interviewed many people on my career and saw this a recurring thing. Being rejected does not imply that you are not good it implies that there wasn't sufficient data on the interview for the interviewers to feel confident on hiring, it is a risk for who is hiring. You can not expect human beings to get it right with 4 or 6 hours of interviewing. Also.. interviewers might be having a bad day :). So. TRY .. again and again and again until you Get what you Want. 

Acknowledgements:
I have used resources that i got from Google, Facebook and Amazon when interviewing :) I should say i did work for Amazon Video and went through all 3 processes. [TBD if I have actually passed Google]

sexta-feira, 6 de março de 2015

Going into Big Data - Cassandra and MongoDB

So.. thinking of a scheduling service i want to try out Cassandra and mongoDB as the data store, from what i have been learning Cassandra seems more appropriate for the use case but i don't know if the learning curve is too high and if it's really needed as is a service that, for now, doesn't need to be highly available.
From my past experience i know is better to design and architect in a way that brings flexibility for the future rather than matching the current non functional s of a project but... if we search for the perfect architecture design we will never get there not only because it would make the project to complex but also because is a false assumption as everyday day new technologies emerge that can be better suited for the use case. The world changes constantly if we don't keep certain assumptions, in software development, we will end up with a NeverEnding  story, drifting from the goal and never delivering something that works for the client.
Another thing to consider is that the best architect or tech lead will strive for the best approach and the most thrilling technologies.  As a leader i have found out that that Emergence is a great concept, brings a lot of benefits but... emergence with no guidance is just like a river that has been struggling with a dam and suddenly bursts ! If there i no guidance for the water it will flood all over the place. Of course if you keep the Dam the water will be under an enormous pressure and becomes muddy :)

As a technology lover i want to try out Cassandra but as a pragmatic person i will compare it with MongoDB by creating a petit POC and analyse, learning curve, performance, availability of plugins, etc. Of course if you are trying to decide between technologies there are more points to be considered:
License/Pricing, Community Support, Who is using it, Roadmap of the product, Resources Availability, Fit for purpose, Infrastructure requirements, and so on.

Let's see what do i select for this particular use case :D

Some useful resources:
http://www.jonathanhui.com/install-cassandra-single-node-amazon-linux
http://docs.mongodb.org/ecosystem/platforms/amazon-ec2/ - as a note on this one you don't have to create 3 different drives to try it out you can use the one provided and just create the directories.


terça-feira, 3 de março de 2015

Unable to connect to AWS instance - access denied for user

Geez this one was a old one. Workbench connected well, the Eclipse AWS plugin fine and when trying to connect using the application.properties, puft...
I had a tab after the username....


I tried to test first through code, lol, next time around i will check the file first.

A simple test you can do:

public static void testMySQLConnection() {
System.out.println("-------- MySQL JDBC Connection Testing ------------");

try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
return;
}

System.out.println("MySQL JDBC Driver Registered!");
Connection connection = null;

try {
connection = (Connection) DriverManager.getConnection("jdbc:mysql://jlo.cefietgq5w13.us-west-2.rds.amazonaws.com:3306/dbname","username", "password");
} catch (SQLException e) {
System.out.println("Connection Failed! Check output console");
e.printStackTrace();
return;
}

if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
} }

Oh well i must be sleepy today

quinta-feira, 29 de janeiro de 2015

Pros and Cons of Using an Ecommerce platform out of the box

Most of the times depends on the scale the company is at, if you are a start-up company with no legacy systems then seems appropriate to use such a solution. Always looking ahead is essential that the tool is extendable and has an API exposed so you can integrate later with other systems and 3rd parties. If you do follow this approach make sure that you don't grow your system into a monolithic structure by doing more than it's supposed to.

Skip to end of metadata

Cons:

Increased Logic in ESB, The ESB becomes a bottleneck and less of an aid to retire legacy systems
  • Monolithic architecture
  • Increased development time
  • Increased testing time
  • Dependent of community/company upgrades
  • Less flexibility for connectivity
  • Complex interoperability - Increased development time to integrate new platforms
  • Single point of failure
  • Need to adapt and extend a pre built product

Pros:

  • Solution out of the box can increase the time to benefit of new features out of the box.
  • Very good for startup companies as it normally provides 80% of features needed
  • Out of the box integration with different payment gateways
  • Product management out of the box
  • Customer manager out of the box
  • Easy to use UI
  • Centralized management














Supporting references:
http://cornerstone-digital.com.au/blog/using_magento_for_your_ecommerce_website/#.VMor_iusVfA
http://www.zdnet.com/article/saas-pros-cons-and-leading-vendors/

quinta-feira, 17 de abril de 2014

GIT and SSH key on APTANA

Skip to end of metadata Go to start of metadata
When you want to use a GIT repository in APTANA follow this steps.

Step-by-step guide


  1. (only do this if you are using github) Go to your account on github and create the repo you want to use. Maybe add a md file. If you are not using GitHub but our own git repository you will need to Add ssh key to aptana
  2. Then in Aptana, File - Import - Git - Git Repository as New Project, follow directions on screen for github username & password and the url for the repo (you can go to your github account and copy the url ('https://github.com/userName/repoName.git')
  3. Do some work in Aptana, add files, folder, etc. then in Aptana's project browser right click on the project name, team - stage, commit, push (in that order)
  4. Go to github and marvel at your new work

Go to start of metadata
You would need to do this when connecting to a git repository for the first time. 

Step-by-step guide

Adding the ssh key to Aptana:
  1. Make sure you have your public and private keys under your user. Example for jlopes user, the files would be inside: C:\Users\JLopes\.ssh (on windows) home/jlopes/.ssh(on linux). The files are: id_rsa and id_rsa.pub. 
  2. In Aptana go to Window/Preferences -> General/Network Connections/SSH2
  3. Edit the correct ssh2 home and files, see ssh2-aptana-preferences.png.

    Ready!

quarta-feira, 12 de março de 2014

XAMPP + PHPUNIT+ PEAR - headache

after a few tries i got pear/phpunit to work in windows7 (so much easier in linux)
Found a good article on it : http://phphints.wordpress.com/2011/06/29/pear-on-xampp/

Pear On XAMPP

Filed under: Doctrine ORMPEARXAMPP — Tags:  — kkruecke @ 1:24 pm
These are the steps I following to get the pear command line utility pear.bat working under xampp for windows.
1. I downloaded the 7z–zipped version of xampp for windows and unzipped it to c:\xampp.
2. I installed the cygwin linux command line utilties for windows.
3. I ran the cygwin “as Administrator” (right click the Cygwin desktop icon and select “run as administrator”).
4. I changed the permissions of the c:\xampp directory to 777
1
2
# cd /cygdrive/c
# chmod -R 777 xampp
5. Set the PEAR configuration settings for data_dirtest_dir and doc_dir. For example,
1
2
3
# cd /cygdrive/c/xampp/php
# mkdir pear/data
# ./pear.bat config-set data_dir c:\\xampp\\php\\pear\\data
Do this for data_dirtest_dirdoc_dir, and cfg_dir as necessary. You will need to create the respective directories first (as shown above for data_dir). Note the use of double slashes! Also note: You may need to do the chmod -R 777 again after the config-sets, to make the subdirectories read/write-able.
To see the current PEAR configuration do
1
2
# cd /cygdrive/c/xampp/php
# ./pear.bat config-show
after running Cygwin as Administrator.
6. Now install the packages you want. For example, this is how you would install Doctrine 2 ORM. Again, I am doing this from the Cygwin shell.
1
2
3
# cd /cygdrive/c/xampp/php
# ./pear.bat channel-discover pear.doctrine-project.org
# ./pear.bat install pear.doctrine-project.org/DoctrineORM
If you want to update current packages:
1
2
3
# cd /cygdrive/c/xampp/php
# ./pear.bat update-channels
# ./pear.bat upgrade-all