It's time to ditch Medium for good! 🌈⚡️

Introducing Devblog by Hashnode. Blog on your domain for FREE. Highly customizable and optimized for developers.

Learn more

I am James Long. Ask me anything.

James Long is the creator of popular code formatter called Prettier. He is a software contractor who loves new user interface techniques, studying programming languages, and building things out of wood.

Ask James Long about:

  • JavaScript
  • ReactJS
  • Prettier
  • OCaml/Reason
  • Clojure
  • Working at Mozilla
  • Starting a company
  • Freelancing
  • Open Source
  • General Programming Advice

Thank you for all the great questions! Feel free to hit me up on twitter (@jlongster) if you ever want to ask me something else. I had fun!

Ask a Question

83 discussions

Hey James,

We ❤️ Prettier, it keeps our code at hashnode nice and neat. :)

What are some other projects you are currently working on?

Right now I'm not working on anything open-source, but I am building a product that I'm hoping to release soon-ish. I'm currently trying to get a beta in front of a few people and see how it goes. It's actually not very secret because I've started to livestream it: https://www.youtube.com/watch?v=a7EGJrwI27Y

It's tempting to keep it secret but I think it's good to be open, especially since the idea is not new at all. It's a personal budgeting app. I livestream every Thursday at 4PM EST.

I work on open-source projects when I'm driven by a real problem that I'm hitting, and I'm currently pretty happy with my environment, and also don't have time to do anything else except work on the product.

EDIT:

I thought I should expand on this answer a little more. One thing I am exploring, which I've talked about a lot on my livestream, is a different interface for stateful react components. One that is more functional. I don't know if I'll ever release this as a proper open-source library but my proof-of-concept is here: https://github.com/jlongster/lively

This also doesn't include client work, of course, but I'm doing some pretty cool React Native work there which I can't talk about yet.

Reply to this…

Share your programming knowledge and learn from the best developers on Hashnode

Get started

Hi James, I got one more question for you.

There are many engineers who believe they do good work: brainstorm features, design and ship them. When they go home, they sleep happy (unless of course they get paged that PROD is broken :P) with a sense of achievement.

That being said, I've always believed that one should never stop learning.

I have not contributed to any major open source projects so far and I sometimes feel like I haven't done my part yet as a programmer. I do learn things on a daily basis from my colleagues, but I would love to learn more and try to become a better developer than I'm today. Would you say that open source contribution are an absolute must in the journey of becoming a better developer? What are the other ways you would recommend to keep improving the way one writes code?

I would not say that OSS is necessary step to become a good programmer. Many people became excellent masters of programming before open source was even popular. Github and other tools have made it easier than ever to collaborate on work, but you should in no way feel like you need to participate in open source to get some sort of programmer badge.

OSS is a very interesting model, but has some serious problems too. Much of the OSS world runs on nights and weekends (which alludes to what you said), and easily creates guilt for a lot of people.

I wouldn't worry about it. OSS progresses because many people are scratching their own itch and find it beneficial to try to get others to use it, either for personal marketing reasons or because it feels good. If it doesn't fit into your workflow you should not feed bad at all about it. In some ways, OSS is a very roundabout way to do things. It's often more efficient to develop tools just for yourself or your team, or learn from people directly around you, or just hack on super interesting stuff, blog about your results and leave it behind. There's a lot of overhead in OSS.

If you feel like you are challenging yourself over time, that's all you need!

EDIT:

I missed your very last question, about what other ways can you improve. I would say try to put yourself in a position where you are challenged and uncomfortable as much as you can. This means writing code in other languages, and trying to work with a library that you find intimidating. You will learn a lot just through that, and your mind will be open to a lot of new things.

Reply to this…

Hey James, I would like to know how Prettier is different from any other formatter?

Prettier is different because of one crucial thing: it takes into account the width of the code and will lay it out accordingly. This allows it to handle a lot of complex code in ways that other formatters don't handle well. The way you want to handle an expression depends if it is deeply nested or not; you may want to break it up more if it is nested. Prettier examines every single expression this way, and produces a friendly layout every single time.

What happens if you don't do this is that the printer will output code friendly some of the time, but in other cases where you've mixed in different syntax it won't work as well.

Reply to this…

How would the JavaScript eco-system look like after 10 years? What's your opinion? 🤓

I asked this question to Andre Staltz too.

JavaScript is a pretty crazy beast that's hard to predict because there are so many interested parties, and so many things that can influence it. Not just leaders trying to shape the language, but everyone working on implementations of JavaScript can change it by discovering new ways to unlock performance for specific patterns previously though impossible, and these new tricks unlock new possibilities of the languages (simple example: JITs rocked the dynamic lang world).

10 years is really long, so I suspect there will be at least 1 more big revolution like React on the frontend space. I think JavaScript is going to continue to lead the UI space, and possible invent even better ways to build it. I doubt this will happen, but there's a small change the JS will even get immutable data structures, which will change quite a lot and even strengthen the model that React uses to build UIs. If so the component model with immutable data may see some platform support. Possibly even native virtual dom in the browser.

I do think we'll realistically start seeing user-land layout implementations in the next 10 years. WebAssembly has crazy potential to unlock a lot of things, stuff like off-thread layout and rendering implementations, so the web becomes a simple low-level platform like an operating system. If this happens, maybe we'll start seeing JavaScript accessibility APIs to keep your apps accessible.

Reply to this…

Hi James,

First of all thank you for all your OSS work obviously 😀

My question is : What made you stop working for others and create your own company ? Was there a trigger ?

Several things, but ultimately I had been at Mozilla for 6 years so that's long enough to start to get an itch for something very different. I'm interested in a lot of things so I was getting annoyed that I didn't have time to pursue them (some of the programming-related, some not).

The team I was on was going through a lot and I got pretty burned out about all the various politics, changes, and dynamics with most of Mozilla. As said in another answer, I don't think Mozilla is bad place and most medium-sized companies are faced with these issues. But the idea of going out on my own was really appealing, with the ability the focus mostly on things I wanted to do.

I'm also trying to figure out the rest of my career generally, so this is a good time for me to work on a lot of different things and try to figure out where I want to focus on next.

Reply to this…

Load more responses