Better HN
topnewbestaskshowjobs
Log inSign up

programminggeek

5,207 karma · joined May 21, 2010 (16y ago) · 1,593 submissions

I am a builder. I build lots of things.
Submissions

comment 14y ago · link · parent

The real problem is that the whole Rails, MVC, ActiveRecord structure ties together three separate things - your app (biz logic, entities), your framework (Rails), and your persistance mechanism (ActiveRecord). Rails should only be used for what it's good at - routes, controllers, views, assets. Your app should only be used for what it's good at - biz logic and entites. Your persistance mechanism should only be used for retrieving and saving data, not defining your application models.

Lately I've been going down the rabbit hole of Uncle Bob's Screaming Architecture and Alistair Cockburn's Ports and Adapters Architecture to create something that attempts to make it super obvious what is going on and where.

The idea is you have an "app" that is totally separate from Rails or Active Record. It consists of Actions, Entities, and Contracts. Actions are basically use cases, user stories, interactors, or some equivalent to that. Entities are just objects that hold data and do validation. Contracts act as a proxy for your data gateways and ensure the input/output formats.

Gateways are the persistance mechanism. They are objects defined by a contract and are implemented as datasource specific drivers that are swappable, so long as the driver adheres to the contract. The "app" side of things doesn't care what kind of driver you use, it only cares that you send and receive data using the right formats.

In the end you end up with your "app" being a nice bit of code that is totally testable outside of a framework or the database. To make it run with a database, you just write a gateway driver for your database that matches the Contract you wrote. It uses the simplest form of Dependency Injection to make this work.

The nice thing about this approach is that your persistance mechanism is totally pluggable, so as you need to scale, you can swap out your gateway driver without touching the app. Also, it's obvious when DB calls are happening in this system because when you call say post_gateway.find you know that it's going thorough the contract, is going to connect to whatever gateway driver you specify, and that it will return in the right data format regardless of if it hits memcache, mysql, mongo, redis, cassandra, a 3rd party api or whatever.

Also, you can write the whole "app" part of your code TDD and get like 100% test coverage. If you feel like you need to test against real data instead of mocking, you can write an in-memory or filesystem driver and your tests will still be crazy fast.

In this kind of system you could still use Rails or any other framework for your views/routing/controllers. You can use ActiveRecord or anything else as long as that code lives behind a gateway instead of being used to define your business objects.

If you are interested in this kind of architecture, I'm planning on open sourcing it soon once I have a few command line generators written to make it a bit easier to get started on.

comment 14y ago · link · parent

This is a big win for Braintree as it opens up the door to a lot of great opportunities they didn't have previously. For example, when starting up a new idea, I never would go with Braintree simply because I wasn't guaranteed I'd sell enough to be worth the monthly minimum. I'd rather take the no risk approach and pay a higher fee per transaction.

I'm sure I'm not the only one who looked at Paypal, Amazon Payments, or Stripe for that reason alone.

comment 14y ago · link · parent

Scala is neat. Lift is a bit weird, but Play Framework supports Scala without venturing too far off the easily understandable MVC pattern. It's a cool language that certainly makes the JVM a better platform.

comment 14y ago · link · parent

I think you'd have to be a fool to think Apple didn't see this coming, but in reality it a big deal for Apple, but not an earth shattering one. To truly improve things like Siri and Maps, you need real world data, user feedback, etc.

I'm sure they are keenly aware of the shortfalls of their own software, as much as they are of the hardware they make. That's the whole point of QA. What pushing out products early does is let you start getting feedback on the known unknowns - problems you'd expect to have but didn't know exactly where they might be, and the unknown unknowns - problems you didn't see coming at all.

comment 14y ago · link · parent

SOA is less obvious up front, as most good architecture tends to be, but the benefits are there over time for sure.

Also, SOA is not always brilliant on day one, but you can give your small app a head start by writing a web api first, then build your app on top of it by making HTTP requests to itself basically or by writing your app as a service layer but not as a separate set of HTTP calls.

The point is you don't have to have a monolithic architecture to start with SOA, you can use a simple RPC or RESTful pattern and evolve it over time as your needs grow.

comment 14y ago · link · parent

Is it wrong that I have a strong desire to write a cheesy blog post about how patio11 made me millions of dollars, or even better about how he LOST me millions of dollars?! I think they'd get me tons of hits, bucket loads of karma, and millions of dollars in ill-gotten ad revenue on my blog. I could retire early and live the life of luxury.

Then I could follow up with a post about how my previous blog post gamed HN and got me tons of cash simply by ripping on patio11, which would be even more of the same. A double HN front page win!

Then I follow up weeks later with a "How To Game Hacker News" ebook.

I feel like I've finally discovered the ? in the Underpants Gnomes' business model.

</joke>

comment 14y ago · link · parent

This I think is a good rule for Yahoo! You need to have a real product in the market to get users. Pre announcements don't drive engagement, usage, revenue, or advertising sales. Eyeballs do. Users do.

Also, the it needs to be a product that could reach 100 million users or $100 million dollars is a great filter. It provides focus.

Unfortunately, based on the last 10 years of Yahoo's corporate history, there are probably a lot of bad habits and corporate culture shenanigans that will need to be dealt with before Yahoo's actions match their CEO's marching orders.

At least Yahoo is trying to do something hopefully more interesting than being another internet media company held over from the AOL era of the internet. Perhaps soon someone at Yahoo! will be able to clearly explain what Yahoo! is and does.

comment 14y ago · link · parent

The whole point of Android from Google's perspective was to give them the ability to control search on mobile without having to buy their way in like they did on the Windows desktop and they do on iOS. Every year Google spends hundreds of millions of dollars to Apple, Mozilla, Dell, HP, etc. to be the default search provider, have their toolbar installed, have Chrome be the default, or whatever way they want to be the search default, and it is worth every penny, but owning their own platform in Android means they control their own destiny on the future computing platform - phones, tablets, tv's, and other embedded computing systems.

Fragmentation is not a problem because Google still is the primary Android services provider. If Samsung or HTC started doing what Amazon is doing and selling Android phones without Google apps and search as a default, then Google's in trouble.

Google's biz model is to give away Android for free, but make up for it in money from the Play market, mobile ads, and mobile search.

comment 14y ago · link · parent

Wasn't HP working on memresistors that were going to be way faster than traditional memory, but they've pushed it back a year or two so their partners could adjust their biz models? Were they waiting for DDR4 maybe?

comment 14y ago · link · parent

Android was designed, I believe I read somewhere, to be the most carrier and OEM friendly OS possible for smartphones. It was meant to be skinned, loaded up with software by OEM's ad carriers, but still to act as a kind of compatibility layer between devices.

That alone solves the dev problem with Java ME that you would potentially need to do hundreds of separate builds for different devices and so on. With Android you have one version for all devices.

From that perspective, Android has gone beyond Google's wildest expectations and it solved at a basic level many of the Java ME problems, but that's not even close to the same goal that Apple had when they made the iPhone.

Why are people surprised that a system that was designed from day one to be what it is today isn't the same as iOS?

comment 14y ago · link · parent

Ok, um, this is not going to work. Half of the magic of Twitter is that it's a single service, so you can subscribe to anyone, pull anyones feed into yours, retweet, share, all that junk.

People use twitter because other people use twitter.

An open service doesn't solve that, it just makes things more complicated and worse.

Wordpress works because it's not a network platform, it's a publishing one. Wordpress is inherently not a social network, it's a CMS. Sure, there are social bits, but it works well as an installable thing because you don't have to deal with issues like connecting or discovering other blogs. You can just install it, write content, and hit publish and boom, you're publishing on your own site on the net.

The only people who see a problem with Twitter right now are devs, not users.

All the "open twitter" projects are going to turn out the way of Diaspora, not Wordpress.

comment 14y ago · link · parent

I'll say this. I like MongoDB, but I've never built anything at big scale with it. For a small project, it's much less hassle to get rolling on than MySQL, so it's cool for that.

comment 14y ago · link · parent

It reminds me of this: http://apc.io/

At some point, we have enough power in a small space that the hardware powering your computer or laptop is basically the size of a credit card and it doesn't matter if it's ARM or Intel.

Apple can save money and get better battery life by making their own chips (as they do in phones now) so why not move that up the hardware food chain once the performance is "good enough".

Apple is about selling mobile devices to consumers and probably the #1 thing the average buyer wants is longer battery life, even at the expense of performance.

Also, Apple knows the power of controlling their own destiny and inevitably when they partner with a company, the same company tends to turn around and resell the innovation as their own products - Microsoft Windows, Google Android, and Intel Ultrabooks. Apple is big enough now they might not need to partner for such innovations much longer.

That could lead to an even bigger and more sustainable competitive advantage.

comment 14y ago · link · parent

It does cost more, it does take longer, but it is basically worth it if only because you are delivering a better user experience on every device. That is the point of responsive design.

Also, to that end, a good responsive design is not going to destroy your ability to navigate the page. It should make it easier.

The hard part of responsive design is dealing with pages that don't always have the same layout. It is a lot of manual tweaking and better tools and frameworks are needed to make responsive design faster, easier, cheaper. It's still largely a new technique.

But, after being knee deep in a responsive site redesign from the ground up, it's totally worth it for the end user.

comment 14y ago · link · parent

ImpactJS is a fantastic tool and Ejecta solves a real problem in a smart way. Phobos Lab does awesome work.

comment 14y ago · link · parent

What is fascinating is just how much of the US economy is debt financed. Some of the biggest industries - education, real estate, banking, construction, retail (via credit cards) etc. are all basically financed by huge amounts of debt taken on by either the government or individual citizens. So in effect, the current economy is built on the future economy's ability to pay for itself.

It seems to me if this trend isn't reversed, the "Great Recession" is bound to keep happening simply because people can only borrow so much.

comment 14y ago · link · parent

I'm going to just say that I was never a fan of the way that Appcelerator handled their framework from a tooling standpoint. To create an app, you have to register it with them. It felt a bit creepy and unneeded if I wasn't going to use any of their other services.

I'm much happier using Phonegap, Knockout, and Kendo Mobile to build apps.

comment 14y ago · link · parent

HFT, brokerage houses, and wall street in general is about providing the service of being a middle man and profiting from standing in the middle of a transaction. Traders via automated machines or human beings facilitate a transaction between a buyer and a seller. That's the business. It's not about providing capital or whatever else people think it is, it's about being basically a sales agent.

Before computers, Wall St. was still largely about trading and standing between people who have money and people are willing to trade ownership for money. That's it.

The problem is that HFT is about profiting on even the smallest trades, but cranking up the volume to 11. It's kind of like what Wal-Mart did to retail, they make less money per item, but they literally make it up in volume.

Algorithmic trading can be slow or fast, but it plays off the fact that machines can compute the data and make a decision faster than humans can, especially on a digital marketplace.

It is unfair to human traders, sure. But, you have a digital trading platform, so at some point it's impossible to stop algorithmic trading.

If you want a market where the purpose is to create capital for businesses without dealing with machine trading, you need to start a new market that is not run by machines and is only operated by human, person to person trades.

comment 14y ago · link · parent

The thing is, it's not Java's fault. You can write good Java code. It can be small, and easy, and nice. The problem is the word Enterprise and the abusive abstractions that seem to come along for the ride.

Also, many of the abstractions start as good ideas, but they soon become a hammer and everything else becomes an AbstractNailFactoryInterfaceManagerProxy.

comment 14y ago · link · parent

So what he's saying is there's room in the market for a software company to take these $35 tablets(in volume), add custom software enhancements, and sell them for $200? Sounds like a business opportunity, if maybe a bit short lived.

Also, why has nobody pointed out the opportunity in taking these and making custom software for various industries like Medical, Automotive, Automation (home or industrial), Sales (of various things).

Custom software on disposable hardware could really turn into some big money businesses. Maybe there's no money in the hardware, but you can add some serious margin by bundling it with custom software and maybe add the tag "enterprise" if you want to sell to large companies.

comment 14y ago · link · parent

The irony here is that if Netflix supported linux, it would likely be via Ubuntu only, and then a bunch of linux users with their own favorite blend of Linux would freak out and it would turn into a potential PR nightmare because Netflix "isn't open enough" and RMS or others would talk about how evil Netfix is for not supporting DRM free truly open technologies and so on and so forth.

Also, the people who want Netflix for Linux already can get it on iOS, Android Xbox 360, PS3, Roku, Windows, Mac, ChromeOS, Apple TV, and on and on and on, so how many more Netflix subscribers are going to join that haven't already? Is that going to be enough money to offset the extra support costs as well as the likely PR nightmare described above?

comment 14y ago · link · parent

Google+ does have one killer feature: easy videoconferencing. It has very much changed the way our remote team works with our client.

As a "status update" social network (in the FB, Twitter, MySpace), I'm not sure that Google+ is going to change the world, but as a set of communication tools, it might end up being what Wave always wanted to be.

comment 14y ago · link · parent

Look, there are some places where document DB's solve problems easier/better than SQL, other places kind of suck. For example, plain old object mapping is easier with a document DB. Relational DB's tend to make your code look/feel/act more relational and less object oriented. Your object model tends to look just like your table structure. This can be good or bad depending on your viewpoint.

There are some approaches to solve some of the author's problems that end up making the Mongo system look and feel a lot more like a SQL system because sometimes data is actually related.

The author could have also taken a different approach to his data schema that would have fit more of a non-relational worldview.

Software development and architecture is about making choices and working with and around the limitations of your tools. It doesn't matter if PostgreSQL or MongoDB are "better". It's about solving a problem using a set of tools you are comfortable with.

comment 14y ago · link · parent

I'm curious what the plan is for that $200 million. Obviously Square is printing money at this point, but what other direction do they see to move out from mobile payments?

My guess is maybe they are going to go after other parts of the small biz segment like making e-commerce easier and so on. Ultimately, if Square can get 3% off the top of every transaction a business makes for the vast majority of businesses, there is a lot of money to be made for sure.

comment 14y ago · link · parent

I'm a big fan of the giving myself some kind of challenge to prove out a framework or technology. Like, "build a meme site" or "build twitter" or something like that. It does two things. One, you are forced to use the technology for a real thing to solve real problems. Two, it becomes very apparent how good the documentation/community/libraries are. Both are critical because most any technology can solve most any problem you throw at it if you are willing to write enough code, but the libraries, documentation, and community make a huge difference in the day to day experience of using any language or framework.

comment 14y ago · link · parent

Um, why exactly would you use something like Clojure if you're not comfortable building up your own particular set of libraries that you like for your project?

Clojure to me seems like a language culture that would likely tend towards smaller libraries that do specific things than something with batteries included and such like Rails.

If you want something on the JVM with more of a batteries included approach Play Framework for Java and Scala is pretty nice and Lift for Scala is cool if you're willing to take a very different approach to your web stack.

comment 14y ago · link · parent

One thing that makes Apple in a very special situation is that they have $100 billion cash to fund various forms of competitive advantage. From the supply chain to the hardware design to the software to the retail delivery experience, Apple can invest an optimize every point in the whole process. It will be fascinating to see how this plays out.

comment 14y ago · link · parent

You're absolutely right, you don't need Sinatra to write a JSON API either. The more ruby devs that realize this the better. Really, just people getting out of the mindset that Rails is the be all end all of ruby is all I'm going for.

comment 14y ago · link · parent

I love Ruby, but I have no love for Rails. Want to write a nice JSON API using something light and nice? Use Sinatra, pick your favorite ORM (even ActiveRecord) and go to town. Why mess with all the other Rails junk when you can have a simple app.rb for your sinatra app and just write simple little controller actions and you're good to go?

You don't need all the ceremony and structure of Rails and MVC to write a JSON api, you just don't.

Worrying about Rails' future and if it's still "winning"(for some definition of winning?) compared to node.js is silly and reminds me of how many Java devs had an existential crisis about the future of Java since Java 7 took a few too many years to ship.

Rails is a web MVC framework, that's it. It's not even the only or best web framework in ruby. Rails is not ruby. It is not designed to compete with node. Node is a totally different thing.

Compare node and ruby and that's a more interesting and correct comparison, but I've happily used both and neither one is going to "kill" the other any more than Rails killed PHP or Java killed C++.

1
444546
54