Project Euler with Clojure 1

I am learning Clojure by doing Project Euler problems and building a web crawler for Amazon products. This is the solution that I have come up with, I filter all the numbers from a range given the two constraints and then I add them up using reduce. It’s definitely sloppy as I didn’t even know how to make this a bit more general instead of making this work only for 1000 (good enough for PE). I’d appreciate much tweets with suggestions on improvements. The wording is as follows:

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.

hackNY Lessons: Week 2

Awesome fellow Terence Nip  had a great idea and he is going to post his weekly learnings on his blog.

From http://blog.terryatjn.com/post/24222772432/hackny-lessons-week-2 ,

I want to come up with a good article on Mocks and Stubs soon, keep tuned, it’s only that I haven’t had much time for it.

Tech learnings:

  • Clojure seems to be very intuitive and productive for me. So glad I’m doing my #hackny project with it.
  • There’s a real need for vim in some environments like the one I’m working on at Lifebooker.
  • Not really a new learning but it’s a pain to learn how a new system is tied up together.
  • I get mad every time I see people don’t use ||= .
  • Tmux can be nice but nowadays I can find easier workarounds to the problem it solves.
  • It’s so hard to test a tracking pixel outside production.
  • Again my testing is getting a bit more solid than before, although I hate the need we have to mock/stub almost all objects.
  • I won’t read so much about a technology that I want to learn anymore. Fb’s motto “move fast and break things” works better for me.
  • So it does my fellow Matt’s tip on learning a language  – “solve project Euler problems with it”
  • People are dumbasses uploading secret tokens to github. You probably already knew this if you follow me on Twitter
  • Even though I’m not the best when it comes to solve git problems, my workflow is simple, efficient and if anything goes wrong it’s always easy to fix. The one where I work is not as simple and it was a major source of problems for the 3 new hires so me and a buddy from work will propose a new one. I love how open is the company that one can introduce such a change in his 3rd week.

Startup learnings:

  • Be your cofounder’s best friend.
  • On the same lines, keep all the paperwork straight with them.
  • If possible, work side by side.
  • Some people are trying to force me thinking models with no revenue prospective should be backed up, maybe I’m too conservative about it but the vast majority of the ideas that I see being funded like this are not worth 10x the investment.

Life learnings:

  • It’s freaking hard to commit to do something daily, even weekly.
  • My project for hackny demofest is going to take me several hours of work. So be it, that’s why I’m here.
  • Chinatown is a nasty ghetto at night. At least Canal St is close by.
  • Central Park is totally fine at night.
  • I came across the entrance of the hospital where Michael tries to protect his father from being killed in the Godfather (1). I really got the creeps.
  • Trying to keep up with people 6 time zones away seems to be harder than when I was in California, our schedule is completely messed up.
  • Unless you’re good friends with your coworkers, try to not know what their personal background is (professional background is ok.)
  • If you keep your ears open, you’re bound to learn a lot everyday especially if surrounded by the right people. I just hope it won’t become a circle jerk (hackny).
  • Work from 6 to 9 on your own stuff, no one is going to bother you and you won’t have to say no to social stuff later on. No checking emails, facebook, whatever, just work straight ahead with a bottle of your favorite drink on the table (it can be Macallan or chocolate milk, who cares)

hackNY Lessons: Week 1

Awesome fellow Terence Nip  had a great idea and he is going to post his weekly learnings on his blog.

Original as I am I will do the same, probably will come with some interesting facts about Mocha this week.

From http://blog.terryatjn.com/post/23778247940/hackny-lessons-week-1 ,

 

Tech learnings:

  • I can’t decide yet if I should learn Clojure, Haskell, or just focus on Ruby and Jav… Coffeescript really well.
  • Learnt a bit about Mocha and when to stub/mock and object on RSpec testing. I will learn a lot about this for the next 10 weeks.
  • I wrote this little Ruby gem that lets you send emails with a Rails template compiled down from a markdown language. (erb, merb, md and string). Still missing some documentation.
  • I have a really hard time fixing to a certain time span when pair programming + I can’t help writing the code when I watch instead of suggesting to whoever should be writing.
  • git Rebase >>> Pull last version + Merge
  • Integration testing must be hard, they have a fully dedicated person to test with Selenium
  • db/schema.rb might not be as useful as it once was, a lot of data is stored on the cloud nowadays.
  • fixed-point arithmetic is awesome and easier to grasp than floating point, but conversion between both is such a pain in the ass
  • I learnt how to generate sine waves without using math.h and any floating point.

Startup learnings:

  • Can’t stress this enough, but have someone to complement your skill set if you really want to launch anything. It minimizes the chances of being a disaster in some part of the business you would not pay attention to.
  • VC money may sound cool but revenue money sounds even better. It will probably sound better to your parents/ and there is a reason to it.
  • From Ryan co-founder of Codecademy, make your life an experiment. I have this pretty much internalized but whatever you spend time trying out, it’s always an opportunity to discover something you love , hate, or don’t care about. This guy spent a lot of time doing bio-related stuff, code for GPUs, and much more. When you find something you love people will realize.
  • Startup stories sound like fairy tales until they actually tell you the whole process. Deal with it.

Life learnings:

  • The more you do might not always be the more you learn, at least for me. I can’t write anything GOOD on sleep deprivation.
  • Go out and meet people. It’s easier to be said than done but just do it. Knowing who to call and having a person to call to when you’re in trouble is so valuable. Don’t be a dick and act the same if anyone needs your help.
  • Trying to impress people is probably among the most stupid things you can do. Just be yourself no matter what the setting is and be honest. Everyone who you admire has probably been through very shitty times, the point is they were strong enough to get rid of the shit.
  • Finding a way to be in contact with people in Europe during weekdays while working hard is ridiculously hard.
  • Having obligations like homework while surrounded by awesome people meeting up just next door sucks a lot.
  • Next week I’ll force myself to work harder when I get home, I guess the guys at Walgreens will be happy with my daily expenditure on energy drinks.

 

HackNY: the beginning

Warning – this post is longer than longcat

Update: 

I finally got here! It took me so long but it’s well worth the ‘pain’. So far I only went sightseeing around where I live (Palladium Hall at Union Square) and Times Square and I love the city. For the first day we just hung out at our apartment getting ready for the internships on the day after.

I got more or less lost trying to get to Lifebooker and we had a first day just learning about how did it all started, what are the main roles at each departments and setting up our environment to work (3 people started to work there with me on the same day). They’re growing blazing fast, making great revenue, and I like the chill out ambient they have at their office. Free candies/chocolates/jelly beans/M&Ms and a bunch of other nice perks, they even have a couple of small dogs walking around the office, only in Brooklyn! Not only their office setting is pretty nice but also the dev group has some talent there, Dan Langevin co-runs NYC on Rails and so far the code I’ve seen is an awesome trade between fast shipping and clean code. Heck they even have a guy, Weston, who develops Ruby on Rails in Windows. It’s amazing and super complicated the setup he has set but hell props to him for finding something that works good when Rails people pay so few attention to Windows.. I am looking forward to get hands on real projects, so far we have just taken a look at a few tickets and took one really simple one to solve as an example, hopefully in one or two weeks I’ll get familiar with the codebase so that I can start working on my own on challenging stuff.

We all went out to dinner last night and had a great time sharing experiences and meeting new people. Heck there was SO MUCH talent at the little restaurant in Little Italy we went to. Christopher Poole joined us too although I couldn’t have a chat with him as we were on different tables but we’re meeting him again soon though. We had a nice kickback at our apartment later too but unfortunately people wanted to sleep in for their internships (obviously) so we finished early. What a great group of people, really.

It’s not like everything is set already but we have an exciting prospective calendar for the 10 weeks the program lasts, featuring crazy good fellows like the Fog Creek crew and Joel Spolsky (Stack Overflow), Chad Dickerson (Etsy), and tomorrow we’ll be hanging out with Zack and Ryan from Codeacademy. On top of that there are so many events around the city so I’m expecting to attend a lot of them like Hacker Hours at Vineapple this Thursday.

Can’t be more thankful to Chris Wiggins, Evan Korth and Manya Ellenberg who run HackNY and made me meet all these amazing like-minded folks, they’re really awesome and it’s so nice of them to dedicate so much time and effort to foster the startup community among college kids, this is the 3rd edition and heck they had a huge success. Too bad I couldn’t have had them as my professors 🙁

Now, back to coding.

Original post:

After about two or three months of public (twitter and blog) forced silence about this, I’m finally proud and able to say I will be part of HackNY  during this summer! In short, it’s one of the most exciting programs for fledgling developers studying in the US or Canada. I knew I was selected for it long time ago but unfortunately we all the batch of people that is going to be part of it had to refrain from broadcasting it until told. As far as I know, this are going to be 10 weeks of pure awesomeness of both an internship in a hot startup at Silicon Alley (they couldn’t find a valley around NYC..), a series of dinners/lectures/meetings with some of the most amazing minds on the startup scene, both from the business and developer sides and also developing some personal project. The internships are well paid and on top of it we get housing right in Union Square (next to Occupy Wall St) in the center of Manhattan. I’m so excited about going to the pool we have on the basement of the apartments!

Honestly I am so thrilled about this, especially after the hassle my trip to NYC had been. I lost my passport a few weeks ago, luckily after I made all the paperwork to allow me to stay here in the US for a few more months after classes are over. The very same day I had to pick all the papers up I noticed I lost it and without a passport on hand I wouldn’t be able to board a flight. After a few calls to the consulate of Spain in LA they just told me all they could do is to give me a temporary passport to fly back to Spain, but it wouldn’t work for domestic flights and it’d even be frowned upon when I use it to return back to Spain. I couldn’t do that because of classes/exams/etc so I asked again at the International Center of UC Irvine.. to be told that I wouldn’t be able to do this and I’d have to stay until they issue me a new passport. Or I could go to Mexico City by car and try to get a new US Visa there and an I-94 card when I come back in. No fucking way.

All set I asked my professors about how could I do my finals earlier and they agreed, although one of the finals will have to be online. Last week I barely slept from Monday to Thursday (7 hours for 3 nights.. sigh) so I could finish all most of the assignments/homework I had to do for the rest of the quarter, study for the finals and therefore be able to fully focus on the startup HackNY assigned me to work with (Lifebooker!).

So I guess I had no other option than taking the Greyhound or the Amtrak, which is what I did (in fact I am writing this post at the train). It’s about 74 hours to get there from LA, with a 8 hours layover at Chicago and some minor stops along the way. After all the sleep deprivation I went through last week I slept a solid 15 hours last night (I missed the Grand Canyon) and I woke up to check out Albuquerque and Raton. We’ll get to Kansas City (MO) around 7am tomorrow so i’ll try to check it out too. It’s quite a comfy ride except the fact that I am bringing two suitcases and one of them is broken, but fortunately I don’t really have to carry them at all except when changing trains. There’s a sightseer car which has glasses all around it so you get to see the country coast to coast and take some photos which is what I’m basically doing and doing some more homework so I’ll hopefully get rid of most of it when I get to NYC. I wanted to get familiar with the codebase of Lifebooker but unfortunately wi-fi at the first train (Santa Ana to LA Union) didn’t let me access to Github.

I’m somewhere in Colorado between Trinidad and La Junta right now but I intend to post this when I get to Chicago and I get some internet. I’ll check out downtown Chicago if I find a somewhere to leave my suitcases at.

 

Portable Executable 101

Visiting /r/blackhat , I stumbled upon a very easy to follow depiction of a .exe file. I always wondered this and when a person taught me this being 15 years old I just forgot it quickly. I believe it would also work for .dlls.

 

 

Cheers to Ange Albertini for creating this. He also has a lot of very nice cheatsheets of x64 opcodes, Java, Android under the Dalvik Machine on his personal website Corkami. They make for very nice posters at your place or just daily use cheatsheets.

Caching using nested hashes in Ruby

Rails 3 was a huge leap compared to previous versions. And one of the new features that was included roughly a year ago is ActionView::Resolver. In short, what it allows us to do is to incorporate elements in the logic that look for templates outside of the standard “views” directory. In fact, we can store them wherever we want as long as an object that finds them is provided, and this object has to comply with the Resolver API. That is not the topic for today’s post.

Such an interesting functionality should be tested, so I have written SQLTemplater, a non-production ready plugin that allows to store views or templates in a SQL database of your choice. And while doing so, I noticed that caching plays a major role if you want to extend ActionView::Resolver for your own projects. That is because the most basic method for Resolver is find_all. From the Rails API:

find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[])

Normalizes the arguments and passes it on to find_template.

And the source code:

If I am not wrong, the yield for cached is provided somewhere else up in the inheritance, but that does not really matter to us right now. What really trickled me out is the nested hash that it uses. I knew there should be some reason to use this syntax so I decided to research further.

Why to use a nested hash to cache templates instead of using any other key?

We could use nested hashes, a simple hash with an array as the key, or a simple hash with the hash as the key. In short, Ruby hashes create a sort of table that stores the hash, key and value. In fact we can think of adding new elements to an existing hash as adding new records to a table. Well, and just a remainder of Data Structures 101, whenever you call hashset[:key], what Ruby does is to calculate the hash for that key and return all the values that match that hash within the hashset. This is done like this for a pure performance reason, it makes a lot of sense to compare just integers (the hashes) instead of the actual objects (the values) which can potentially be a lot more sluggish.

When Object#hash creates a hash given a nested hash as key (i.e: hash[a][b][c][d]), just like ActiveView::Resolver does, the hash keys are either strings or booleans, and luckily that is blatant fast. If we try to get a hash given an array or hash as the key, that’s a lot slower.

I found this benchmark on this online again by awesome Jose Valim, so just take a look at it, and if you feel more intrigued about this, check my repository SQLResolver to see how ActionView::Resolver can be finely honed for your own needs.

 

Extending Rails

I am currently reading Jose Valim’s newest book, Crafting Rails Applications. It digs into the newest Rails 3 APIs, extending ActiveModel, Railties, Generators, Responders, etc… I truly recommend it if you are already familiar with Rails.

Back to the main topic of the post, I would like to share two projects that I have been working on with the book, the first of them is a PDF Renderer for Rails. I never thought it would be so easy to extend Rails’ native renderer so it can render other type of files like PDFs, CSVs, etc… You can browse the code on the repository and notice it is fairly simple to include such functionality. Pull requests anyone?

The latest project I have been involved with is a simple extension of ActiveModel, which I decided to call FFMail (as in Form for mail). It extends ActiveModel to use ActionMailer and send emails through a contact form. It is very easy to add this to your Rails application (check out the instructions on github) and I even included a couple of extra functionalities like I18n internationalization for the emails and a very simple spam detector without needing a captcha. The way I did this was basically to hide a form field through CSS , namely “Nickname” that users would never fill (who on earth fills forms through manual POST requests aside from Richard Stallman??) but some robots will fill it and hence the mail would not be sent.

 

I just like to emphasize how Jose Valim ROCKS and so his latest book does 🙂

 

Links to the projects –

RRPDF – PDF Renderer for Rails – https://github.com/eLobato/RRPDF

FFMail – Contact form for Rails extending ActiveModel – https://github.com/eLobato/FFMail

Rails’ new seamless integration with Amazon’s DynamoDB and S3

I recently attended Cloudstock at San Francisco. One of the hackathons I attended was about deploying a Ruby app that pushes to and retrieves records from DynamoDB, and uploading photos to S3. It involves several steps but thanks to Trevor Rowe (author of AWS SDK for Ruby) who helped me, I finally succeeded and created a implementation that works pretty nicely. He made a really good work so I will assume knowledge of ActiveRecord here, as it works in a pretty similar manner.

I included some information on how you could replicate this functionality on your Rails app in this Github repository. Either way I will explain better how to do it here.

Set Up

To set this up, as we won’t use ActiveRecord, call:
rails new your_app_name --skip-active-record
In order to get the AWS Ruby functionality, add the ‘aws-sdk’ gem to your Gemfile and execute ‘bundle install’ to get everything set up.

Initializer

See config/initializers/aws.rb . This gets called when Rails is initiated and it will log you in, provided you give your Amazon access_key_id and secret_access_key. The file should look like this:

Model

Instead of getting functionality from ActiveRecord, we must inherit from AWS::Record, and attributes are hence defined in a different manner:

In order to write or retrieve information to S3, we use the following method, where images_cloudstock is the bucket in S3:

Be wary that you should implement some sort of mechanism to avoid making too many calls in order to avoid getting to your S3 quota quickly. In this example there is a boolean attribute that takes care not to call to the database if there is no image.

View

I included a file_field caption in the form so that the users can upload their photos to Amazon S3. This is only done whenever there is already an id in DynamoDB set for the record (if @user.id).

In order to show this photos I call the user model in index with (user.img) so that the image is retrieved from S3. Try to call this method only if you are sure that the record contains an image so you can avoid unnecessary calls to the database.

Routes

Default controller redirects to @user using the default Rails ids, which by convention are just integers. DynamoDB uses ids with hyphens, lowercase and uppercase alphanumeric characters, so you have to figure out a way to handle this in routes.rb. A regular expression works well.

Yet again, Skinny controller – Fat model?

I do not want to set any basis on this topic, but I have heard this since I started with Ruby on Rails. Why this blog post? Because I found that sometimes people (me included) just get on the surface layer. To put this simple, I would draw an easy simile:

Skinny controllers should be as skinny, and fat models should be as fat, as you can bear for a catwalk model.

Ok, this may not hold true for all guys but I think the idea is well depicted.

Secondly, I would like to note a couple of tips to make our models as fat as you can bear and your controllers as skinny as you can bear. I once was given a very important tip on something that anyone with a formal training on computer science should know, but that we mostly often forget. Honestly I am one of these guys who just get high using Vectors, Hashes and LinkedLists as soon as possible. Think through and strictly make sure that there is not a more efficient way (though less readable) of accomplish our purposes. Sometimes you may want to sacrifice efficiency and increase complexity by choosing a very clear solution but for me that is probably not the way to go in a web application. The old saying goes like this:

Smart data structures and dumb code works a lot better than the other way around.

That itself is your clue that the logic for those relationships, including validation should be in the model or database layer. An skinny controller is the consequence of well-designed data. The more effort you put into designing your data, the less code you have to write overall.

Controllers are best at parsing inputs, calling the appropriate models, and then formatting the outputs. Then you should let the model do validations (Rails makes this easy as pie). Make this as skinny as possible, so if you chose your data properly you should not be writing clumsy and messy code.

I think I do not have to mention avoiding atrocities like this:

 
And keep it like this.
 

8 differences between American and Spanish universities – FIXED

I have come across this article when reading Meneame, a really nice news aggregator (think of Digg, reddit) mainly geared towards a Spanish audience. This particular post explains a bunch of differences that an Spanish exchange student in Oklahoma finds when comparing Oklahoma University and Universidad Complutense de Madrid. To be fair, I would prefer not to extend my experience here to the whole US but as far as I know, there are a lot of similarities between top American universities. I am going to try to sum everything up so that people can get a grasp of what it really is to live in an American university. There are no words to explain how different it is and there is no way to try to comprehend to the fullest this if you haven’t been studying in one for a while, bear that in mind.

To provide a little bit of background to new readers my name is Daniel Lobato (daniellobato.me) and I studied Computer Science at Universidad Carlos III de Madrid (hereinafter UC3M) for 2 years before I came here. I had the enormous pleasure to be a part of the first class in UC3M that had studied according to the Bologna Process. Besides this, I studied in a bilingual group at UC3M which meant that all exams, classes and teaching material were in English. Most of the classes held around 20 people at most. Obviously that was a factor that really affected my student life a lot since it was a lot easier to get in touch with the professors (at least easier than in regular classes). Being in a bilingual group meant a lot for me, and it truly influenced me to an extent that I am sure that being in a regular class would not have changed me at all. A very particular fact that I liked was that most of my classmates had a better-than-average background both academic and life experience.

I have the great honor of being the recipient of a well demanded scholarship in UC3M to study one year abroad in an university pertaining to University of California system  depending on what you study. I am now in University of California at Irvine in the OC (eastern LA), public ivy, around top 20-50 for Computer science in the world depending on the ranking. Its CS department is especially outstanding partly because of the donations of Donald Bren. Definitely a great place to study and well reputed at least within the US. And Kobe Bryant comes to our gym to train!

Money

Tuition fees for a technical degree in a public university in Spain (usually they are the best ones with the exceptions of private colleges Universidad de Navarra and Comillas) range from 700 to 1500 euros for on campus instruction. I have no idea what the fees are for online degrees. A year ago I remember Jesus Carretero, head of Computer Science department at UC3M mentioning that Spanish tuition is subsidized so that the real cost of our education would be around 7000 euros per year.

Tuition fees in UC Irvine are $13,970.00 a year, just for the tuition. If you are not from Cali tuition rises up to $36,848.00 a year. Most of the student have to live either on campus or off campus but close by the university. Housing is definitely cheaper than in Spain, living in a ~1000 feet apartment, 2 bedrooms 2 bathrooms, big living room with a kitchen and a patio, several pools, hot tubs, gym, laundry rooms and a lot more of outstanding facilities is only $485 a month, which is fairly decent especially for the Orange County which is one of the wealthiest areas of the US. Obviously I share room but even if I did not you can rent for slightly less than $1000 per month.

Tuition is basically paid through loans and grants. If you cannot afford tuition here usually you can apply for a Pell grant, Cal grant, Gates scholarship, etc… Most of the people I know here have some kind of financial aid aside from federal loans so it helps them to get out of college with a smaller debt.

National endowment for UC Irvine is around 370 million dollars. It is estimated that they earn around 270 million dollars in tuition fees, making it a total of  640 million dollars for a single university. There are probably other sources of income that I have not found, but this is the whole endowment for all public universities in Madrid.

Universidad de Alcalá, 92.724.427 euros; Autónoma, 152.845.856 euros; Carlos III, 94.357.170 euros; Complutense, 370.374.509 euros; Politécnica, 220.327.687 euros, Universidad Rey Juan Carlos, 83.898.953 euros.

The only one that gets close to UC Irvine in terms of income is Complutense and it has more than three times as many students as UC Irvine.

Time

Putting it simple, schedules in UC3M take up all of your day in most of the cases. All classes are 1 hour and a half (WTF?) and you cannot expect to have much social life or work aside from classes if you want to attend them. This is dramatically different here. As an example of my schedule, last quarter I had to go to class 3 hours a day every Monday Wednesday and Friday. That is all. This quarter I am spending one hour everyday for lectures. They are only 50 minutes long but it takes some time to get to the place and sometimes you want to ask stuff to the professor after class so let us make it an hour. You may think that this is madness and students cannot learn properly through such a system. I dare you not. More free time means working experience, most of the students come out of the university having already done a couple of internships, research or part-time work. More free time means socializing, which can be potentially networking if you know who to hang out with. And it means more quality of life, less stress. When I studied in Madrid I barely had time to do anything aside from studying. Obviously I spend a lot of this free time studying, doing assignments, learning on my own. But having this amount of free time also gave me the opportunity to work on a start-up last quarter, it gave me the opportunity to exercise a little bit and right now I am doing undergraduate research, which is something unthinkable of in Spain.

Opportunities

Universities are thought as a place to learn in Spain. There is nothing you can do there besides going to the library, attending lectures and hanging around at the labs with your mates. As opposed to that, here universities are well thought as a place to provide a well rounded education. A lot of lab departments are seeking for undergraduate students to help them out. A lot of companies are willing to have a student working part-time with them. And even if you are a lazy bum and you do not want to work nor do research here, which is an outstanding experience by the way,  you still can join one of the several teams that the university has for a lot of sports, and compete among other state universities or even nationwide. I will cover this a little bit more in the bullet point ‘elitism’ but certainly there is an enormous amount of interesting, challenging and well paid software projects and we really lack this in Spain. Unfortunately, I think this applies to most of in demand jobs in Spain.

Classes

Honestly the difference is not that big with the bilingual group in my university as we had the chance to be in small groups. Nonetheless it is really remarkable that most of the students here go to classes where no more than 30 people per class, where you can easily ask questions and discussions are almost enforced instead of letting the students sleep through a dull lecture. However it really depends on the professor, which leads me to the next point.

Professors

There is a HUGE leap here. I cannot think of a single professor that I have met that has not have a resume tailored with world-wide accomplishments in their fields, an Ivy league alma mater, or similar impressive stuff. Getting a chair here can take up to ten years, which is basically the same amount of time that it could take in Spain, but the point is that they get them chosen on merit. Being the best friend, or even worse, being the lap-dog of some faculty member will lead you nowhere if you are not a game changer here. Also, money plays a crucial role here. They hired people like Michael Franz (inventor of the JIT compiler), David Patterson (arguably one of the world leaders when it comes to computer organization) and a handful of celebrities within academia that would not come here if salaries were not according to the market. Let us be fair here, taking an undergraduate course with these people will probably not differ that much from taking it in UC3M as the content will be similar. But the hints that one of the best people on his field can give you attending discussions and tutorships really differ a lot from the ones that a non-motivated teacher can give you. It is funny to see how the CS departments (not all of them but most of them) are a carbon copy of what is going on in the Spanish IT industry, etched 20 years ago. I do not really know how this works for the rest of the departments but from what I have seen there is even a worse difference as non-technical knowledge can really change from one university to the other.

Social life

Spain. Ibiza, Madrid, Barcelona.. definitely the place to be when it comes to great parties and socializing. First day of class in a Spanish university usually ends with some groups of people drinking a couple of beers in a bar and getting to know each other. That is definitely ingrained on us and I would not change it a bit. I have to add to this that a lot of people study in their own cities so hanging out with their high school friends is very common as well.

Still, this is about the differences so I would say that a main bullet point here is that most of Americans go to college somewhere in their own state but far away from their home. This means that they virtually know nobody there, so the best ways to socialize are either by joining fraternities and sororities, clubs, or just getting to know who you live with. Do not expect to meet people at class as most of the people will be very focused on what is going on today and will not pay any attention to a stranger that is distracting them from the main thing (the lecture). There are about 200 clubs solely on UC Irvine, so it is easy to find some people with your same interests or in similar situations as the one you are living. To be fair Americans are very outgoing and will always be up for some chit chat but developing a friendship is something that takes a lot more time than in Spain, where you can consider this guy sitting next to you with whom you have been hanging out with for a week a good mate.

Elitism

Contrary to Spain, where studying in college can be considered relatively common and for sure not a warrant for a well-paid job, America is still rewarding their college graduates quite nicely. If you have been to a decent college, got a decent GPA, done a few internships, even though your knowledge may not be the best you can easily expect a well paid job ($3000 to $5000) for an entry level position in technical fields. In fact if you are really outstanding you may be earning more than that as soon as you graduate. Summer internships (for  CS undergraduate students) in San Francisco are paid ranging from 4000 to 5000 dollars a month which is something unthinkable in Spain. I have seen quite nice offers in LA for $3000. Getting a good university education here is something people really care about, and not making the best of it is seen as a real problem. A lot of engineering degrees in Spain usually take 7 or 8 years to a lot of people to finish them when they should take only 4 or 5. Such a waste of time is seriously seen as irresponsible here. I do not blame the people that have gone through this but definitely the universities are not providing the means to finish with this. Rich kids, poor kids, you can find them all, it all depends who you hang out with but what you certainly can expect is a majority of well-rounded educated human beings, whilst there is almost no filter for jackass getting in the Spanish university system. I am not saying everybody here is amazing but the filter they have to pass and the effort they have to put raises the bar a lot. Not to mention what the bar is in Harvard like colleges.

 

That is basically all I can think of as of today, drop a comment below or share this if you found it useful!