Missed the AMA? You can still connect with James Long and ask questions on their Hashnode profile
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!
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.
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.
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!
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.
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.
I asked this question to Andre Staltz too.
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.
Prettier is an awesome code formatter. 🍺
Just for the information:
- What do you think it doesn't do best?
- What are the demerits of using Prettier?
Right now it's sort of optimized for line lengths in the 80-90 range. If you gave it a print width of 120, it probably doesn't print code quite optimally, but personally I'm not as bothered by it. This has been reported by others though. It flows too much code on one line. There are probably some tweaks that could make it better.
I also have a vision of allowing end users to use prettier with whatever kinds of options they want, and only commit a specific style. This would require a different kind of editor integration though that it doesn't do well right now.
The demerits might be that new teammates may not like the style and it's too forceful. But honestly, I think it's a good thing for teammates to be forced to just accept what it is. I can't really think of any strong disadvantages to using it except for re-training people who are used to a different style.
I don't think it's a big problem, but I think it's a problem. A great example is create-react-app. It's definitely tiring to setup webpack, babel, and other tooling just to make a production-ready app every single time. create-react-app completely solves this problem in a way that works for almost everybody, so the fatigue is gone.
People talk about is as if it's some deep cultural problem, but I think that's stupid. Deep cultural problems are very hard to fix. But the things that actually cause fatigue are pretty easy to fix, like create-react-app showed.
Thanks for doing this AMA, James. Have been reading your blog regularly.
What are your plans with Shift Reset LLC? Do you want to be just a service provider? Do you plan to contribute to Open source as a company?
What does the green colour symbolise in your blog website's favicon? :P
Hello James, how important do you think it's to adhere to establishing coding styles?
At my previous job, there were many comments on the PRs regarding tabs and spaces. Now, my question is, there are companies which do not really have the luxury of time and man power - think of a small start-up with two engineers having to ship a ton of features.
Would you still emphasise on adhering to coding styles and patterns, or can the PRs be merged as they're and you can come back at a later time and fix the styles/standards?
I absolutely think it's low priority, and should just be automated as much as possible (hence prettier). It's really annoying to me that PRs would get blocked on such simple stuff like style. I get that you don't want code to get sloppy over time, but I much prefer a process where the team goes through and cleans up the most egregious offenders weekly or something. Basically, make that async, instead of blocking the workflow.
I only use 2 or 3 linting rules, ones that really matter (like using unknown variables, stuff like that), and prettier automates formatting. I don't think you should worry about much more than that.
I'm thinking about creating a tool similar to prettier but for a language we use internally in our company, and I'm thinking about using Scheme to develop the tool. I just started to learn Scheme so I'm wondering whether or not such tool could be created using Scheme ?
Oh sweet! I used to use Scheme. You absolutely could, but the only problem is tooling. When you do anything with compilers or ASTs, there is a lot of boring stuff that you need to take care off, like tracking the original location of the code so you can show nice errors, attach comments somehow to the AST, etc. You will be better off if you choose a language that already has compiler tooling for the language you are targeting, otherwise you will have to rebuild a lot of boring stuff yourself.
Which code-heros do you look up to most (twitter handles appreciated)?
Hey! What are the books that made an impact on the way you work?
Honestly, these days I only read books that introduce something fundamentally new, like a new language (I read Real World OCaml to learn OCaml). I don't read many books though. The best thing in my opinion is to watch languages that have different philosophies, like Clojure, Go, Rust, and more, see what kinds of libraries they are releasing, and study why they made them. I've learned a ton from Clojure especially, even if I don't use it daily, by studying channels, immutable data structures, spec validation, and more. If they release something I pretty much know it's super interesting without looking at it, and if I study it I always learn new things that impact how I think about code.
I used to use Scheme, which is derived from Lisp, and in the Lisp community these were frequently called "aha!" moments. I don't think you should study things solely looking for these moments, but if you challenge yourself and dive into things you don't understand, you will naturally learn and slowly understand it and eventually experience these kinds of moments. If you're looking for that, I'd say you're looking to challenge yourself, and getting "aha!" moments is not quick or easy. It's usually several days/weeks of "pain" (but usually fun) until it all comes together and clicks.
I can only speak for myself though, and maybe others learn in a way that don't experience this so much. As long as your learning over time, that's all you need!
For me, Scheme taught me tons of things. I had several "aha!" moments when I was learning about continuations to control program flow (and do crazy things like abstract away data structure details with delimited continuations).
What are the pros and cons of freelancing for you? What would you recommend someone do if they want to be a successful freelancer?
More control over your time and what you work on. Outside of client requirements/deadlines, you can scale back work if you want to focus on something else for a while. You can choose different work each time and keep things interesting.
Meet lots of interesting people. I find networking somewhat enjoyable. I wouldn't want to do it all the time, but I like meeting people and seeing what they are working on.
No office/team politics or dynamics to deal
No office/team to collaborate with :) Being challenged with social issues is important and it sharpens your ability to communicate and work with people. You have to be really careful not to isolate yourself.
Variability of money, naturally. You need to track things to make sure you make enough on average
I would only do it if you find networking somewhat interesting and have a pretty strong network to begin with. I wouldn't do it if you don't already have a decent network. You can start that by blogging, going to conferences, and things like that.
What's your personal opinion on AngularJS? Have you tried it? Would you recommend a beginner to try AngularJS in 2017?
I only used Angular 1 several years ago, so my experience is extremely outdated. I have not tried Angular in it's current form. I think it's great that multiple frontend solutions exist and you should learn whichever one resonates with you at first. Getting productive with one of them is way more important that "choosing" the right one.
You will also learn about all UI solutions as you learn one of them. Many ideas are cross-pollinating, meaning that you will see traits of react/redux in other places and the communities do a good job learning from each other. You will also start seeing contrasts and understand better why react/redux made certain decisions as you hit problems in angular, and understand the the tradeoffs.
Thanks for all your work, James.
Seems like you're such a skilled programmer with a deep understanding of many CS areas. I'm curious why you chose frontend as your focus profession. Just as an example, you could have done some crazy distributed systems, ML, low level virtualization etc.
I think at the end of the day I want to be shipping things to people, and frontend is where you feel that the most. It's where a lot of hard work (from the backend, etc) can be brought together into a real product, and that's exciting. Having knowledge of all the parts of the system helps me build better UIs and understand the tradeoffs (optimistic updating, how to pass data back to the server, etc)
But it's an apt question because I do have a feeling that I might change my focus at some point. I am interesting in machine learning and graphics programming, so we'll see if I can make that into an actual job.
There's also the fact that it's just so practical to work on frontends. There is so much work and good jobs out there. I used to do a lot of graphics development but I wasn't interested at all in getting into the games industry. So part of it is practicality.
If you had a startup, which framework you would choose? (React,Angular,Vue,Ember...)?
Easily React, but that's because I know almost every single little detail about React. A startup should focus on it's product and the users its trying to solve problems for and not on the technology. Focus on whatever the founders or current teams already knows so they can be shipping faster.
How much time it took for your to develop prettier? How you started?
Prettier was such an awesome project because it already has lot of well-established research, so it came together really quickly. I just got so frustrated that it didn't exist so I sat down, took an existing printer (recast) and started hacking on it.
I started around Dec 1 of 2016 and had something that handled 95% of the common cases by January. So it only took about a month to be close to the initial release. This was mainly because I had a paper (A Prettier Printer) which described the algorithm in full detail and an existing project (recast) to fork and hack which covered a lot of the mundane material.
Thank you so much for making such an awesome tool as prettier. It saves me a lot of time on a daily basis.
How was your time at Mozilla? What are all the project you were involved in?
My time was great at Mozilla. I grew several "levels" as an engineer, worked with lots of smart people, and they treat developers very well (with benefit and remote friendliness). I was on the webdev team at first, then involved with researching webapps with Firefox OS, and then developer tools.
Mozilla has experienced both severe growing pains and extreme market pressure from competitors. They made some really bad choices in the last 5 years and have not really kept up with competition. This year they are finally trying to recover from that, but we'll see.
I did deal with a lot of ugly politics while I was there. But I'm not sure it's entirely unique to Mozilla. It's probably the sort of stuff that most medium-sized companies have. A lot of people are promoted into middle-management that just aren't good managers. Lots of times where there was something destructive going on and managers would simply not act. And I'm even a white male - women and other minorities have it much worse.
Where to start: ES5, ES6, TypeScript, AtScript, Dart, Babel, ... or where did you? :)
I got lucky because I started before most of that existed. :) But really, I think create-react-app is a great place to start. It has everything set up for you that you need and you never have to worry about it. Write ES6, explore React, and go from there.
After that you can try TypeScript or Flow. I'd recommend choosing whichever fits the best for your current app. Depending on the libraries you are using one of them might be more supported.
But really, just get started! If you don't know where to start, just load a JS file in the browser and start with vanilla DOM APIs. You will learn a lot and then you can make choices based on that experience.
Complete this sentence... If I weren't a programmer today, I would most likely be earning a living as a [??], and here's why [??].
Oh that's a good one, and easy for me right now: a woodworker. I'm getting a large shed built behind our house right now that I'm going to turn into a workshop. I really enjoy it, but it's also potentially lucrative. I can streamline the process of creating beautiful tables that sell for a pretty high price ($700-1000) and if I did it full-time I don't see why I couldn't make a living from it.
I love that it's something you do with your hands, requires a lot of problem solving of a different kind, and is creative as well.
How many people are working on the product on https://www.youtube.com/watch?v=a7EGJrwI27Y and if it is only you, why did you choose to work on it by yourself?
It's only me, but I have a few friends that are giving me advice. I didn't really choose to work on it myself, but I haven't found anybody who is the right fit yet. It's hard to find people who have time and interest in this kind of app, and also is the right "fit". If I release this and it actually gains traction I expect to find help, either part-time contractors or something like that, depending on the funding situation.
Thanks for the AMA, James.
What does your workspace on your machine look like? What OS do you use, and what are some applications which have helped you stay productive over the years as a developer? :)
I tend to be minimal. Right now I use OSX (macOS, whatever) but I keep looking at the surface laptops and they are look enticing. I'm usually working in Emacs, Chrome, and iTerm2 (although been meaning to look at Hyper again). Emacs is my foundation for everything. dired-mode for interacting with files, magic for interacting with git, and I can run shells within emacs itself (and I usually use CLIs to interact with everything else).
For my personality, what helps me stay productive is minimalism. If I need to I'll even block certain websites to really force me to stay on track. I also think having a few single tools that last over time is better than depending on too many tools that either break or change over time. So I like to master a few things and stick with them.
Where can I see Prettier deployed?
I really enjoyed watching you code and listen to your insights in the last two screencasts you published on youtube.
I like how you actually work on a product and allow others to watch. There is so much to learn. The best take away for me though, is that I get to see how other people really work. I tend to be really hard on myself and think of myself as a shitty programmer. Watching you debug and your messy code (dont get me wrong you are a way better programmer than me) was just good for my mental health. Hope you understand ☺️
Will you be doing more?
That's amazing to hear! I am really enjoying it, it's almost cathartic to me. I don't work in an office so for me it's a way to get ideas off my chest, even if nobody is listening. It's recorded so I link back to it, and it's basically a way of lazy blogging.
I was skeptical that anybody would find it interesting, but hopeful it would show that even really experienced people do a lot of dumb stuff. I think there's too much "reverence" for people that seem smart and it divides us too much, when the only difference usually is some people are pretty good at blogging and writing their thoughts out, and there are really tons of smart people that don't give themselves enough credit. I'd love to break this down as much as I can by livestreaming. So thanks for the good feedback!
I definitely will be doing it at least every Thursday. If I can, I would like to do it even more often.
- What motivates you to do open source?
- On a day, how much time do you spend on open source projects?
Love your recent livestream videos. Very informative.
Open source is a way to simply get feedback from others in the community, and "vet" ideas. It's motivating to know early on whether an idea is going to work or not, and people will help you think about problems earlier than you would have yourself. It also just feels good to be a part of a community.
Lately I haven't been as motivated since I've been starting to focus less on specifically technical ideas and more solving problems for people. Basically building products.
Right now I don't spend any time daily on open source, honestly. I probably only spent a few hours a week. I am going to start working on stuff for prettier again, and I tend to go in bursts, but even then it's probably only a few hours every couple of days.
I'm glad you like the livestream! :)
What are your favorite things to do (passions) away from the computer?
I'm currently obsessing over my tomato plant outside and it finally is starting to grow 7 tomatoes. I took gardening pretty seriously this year and next year plan to plant a much larger garden. I installed a drip system so it's automatically watered.
I also really enjoy woodworking but don't have a place to do that, but that's about to be solved because I'm getting a workshop built behind our house. Soon I hope to be making tables and other things like that.
I would love to be able to draw but I haven't ever had time to really get into that. I feel like that's something I'll do later in life.
Recently I've been getting pretty interested in finance and investing too, but that's somewhat related to technology.
1) How was your experience with clojure?
2) What are its coolest features?
To be honest I haven't actually used it on a large app yet. I haven't worked on a Clojure project and I've only done small projects. However, my experience was good, the language is awesome, but when I was using it there was some pain getting it setup. I think that's better now.
See this answer for it's data-first model: https://hashnode.com/ama/with-james-long-cj5x0mut902fwjpwtiqsu0ypn#cj62j1ok4008zvmwt58ddjhck
On top of that, it has a really powerful form of objects and protocols, which allow you extend and existing type but the extension is only locally scoped to the current environment. Think of being about to add a
toNumber function to the JS
String type, but it's only available in file that have imported your extension. It's like a safe way to monkeypatch; it's awesome.
Hi James, I am using MERN to build a website, I use react-helmet to SEO but it isnt working! Please tell me how to SEO it? Sorry for my bad english!
How did you start your programming career?
I'm in a cliche in that my dad brought home a computer when I was young and I just started hacking on it. It was an Apple II and back then programming and using the computer weren't that different... it was so easy to start writing code that eventually you just started doing it if you used the computer for any length of time.
The thing that drove it home though was in high school I was super interested in how 3d games worked. I was in awe that computers were able to render games like Doom (the first version) with such a rich interactive experience. I really wanted to know how that worked so I bought a book called "Rendering Real-Time Graphics with DirectX" or something like that. That opened up the whole world to me and I loved programming.
This is probably no surprise to most people, but: spaces, emacs, composition, get lots of sleep.
This question is related: https://hashnode.com/ama/with-james-long-cj5x0mut902fwjpwtiqsu0ypn#cj62j1ok4008zvmwt58ddjhck
Heya James :) I'm trying to get a remote job atm. I'm sitting in the DomRep and trying it via various platforms, mostly angel.co/stackoverflow-jobs. However, it seems really difficult. To the east often the timezone issue is a problem, to the west it's either US and they don't do non-US-citizens, or Latin America/Canada where very little is happening. Do you have any suggestions?
I'm not familiar enough with issues for non-US people, unfortunately. I'm sorry you've had a hard time. I would say that a truly remote-friendly company should not have a problem with that timezone, in my opinion. A lot of companies say that they are remote-friendly but most people live in the same city, and you don't really want to work for them. You'll feel pretty isolated. Aim for companies that already have people spanning timezones.
Keep building up your portfolio and experience though. It's a little more risky for companies to hire remote, so anything you can do to prove that you are worth it would be good.
Hey James, thanks for the AMA! Favorites programming paradigm, programming language, tools, etc?
Clojure embodies my favorite programming paradigm: functional, immutable, and data-first. "data-first" means that you think a lot in terms of data, and Clojure has a lot of powerful methods for working with that data in really clear ways. You don't write a bunch of classes that have
this.state. You just have
state and you pass it into functions.
Code that favors immutability is far more robust. I can't stress this enough. Even if need to mutate an array, if I'm doing some complex logic, I will abstract out as much as I can into immutable/pure functions that take small chunks of the array and return new data, and then only at one specific point in the code it will mutate the array with a
splice. Being very explicit about where mutation happens makes things a whole lot clearer. Otherwise you don't know when the earth moves from underneath your feet.
My favorite programming language right now is probably Reason because it feels like I'm learning a lot, which is fun. And robust static typing is pretty powerful.
Emacs is my operating system of choice. I spend 90% of my time in it. It's so flexible, and although not very modern, has a lot of really powerful workflows.
1: Will there be actual configuration options in Prettier? As in not just a handful of switches, but a full config system like ESLint.
2: Can Prettier be ported to other languages? Are people doing that?
There will never be configuration options like that in prettier. One of the main points is that it limits the variations of styles.
The core algorithm of prettier certainly could be ported to other languages, but it would have to reimplement all of the printing logic specific to that language.
I would like to know how do you start architecting a software when starting from scratch, do you think of maximum requirements at first and build accordingly or change as per requirement comes or something else?
Also, should someone redesign the code when they feel they could do better than the current one, given redesign can be costly for the company ?
That's a great question.
My style is definitely to just start coding. When you are starting from scratch you have very little idea of what the requirements are. If you start building you will run into a lot of things very quickly and learn a lot.
Then, after you've spent some time building out something, you can step back and start thinking about proper abstractions. Here you probably don't want to code but want to outline boundaries and cut the system up into a few large subsystems. You basically go top-down, but only very shallow. Establish the basic architecture, but give room for all of the subsystem to breathe. Those subsystems could be implemented really messily, but be refactored completely later, and if the interfaces are built correctly the other subsystems would never know.
Redesigns need to be evaluated in light of how much money it's going to save the company down the road. You should almost never redesign an entire app. You are losing way too much gained knowledge and that investment will most likely not pay off. But if you have a good enough architecture, as explained above, you should never be forced to redesign an entire app. If you're app is so fundamentally flawed that you need to redo the entire thing, you're in trouble. Usually, you just need to redesign a subsystem, and if you really believe the new design is better, the company should support that because better code, if done within a realistic timeframe, will almost always pay itself back by reducing maintenance costs.
What was the first project that made you really confident about your abilities as a programmer?
In your blog post about becoming a better programmer, is there any reason why didn't you list Haskell as a great language to learn? Or are you just not familiar enough with it?
Hey James, What stacks of frameworks and languages are you using for development?
I've always loved Clojure(Script) but haven't had the chance to work on a project in it yet. And recently Reason has me interested and with all the React support coming out for it that is likely to be my next language of choice.
Hi James, I am java developer and for 4 years now I am mostly working on backend application based on spring batch, spring framework. I have also worked on Webservices in Java however I was looking to move into fullstack development. Currently I am refreshing my JScript skills, how should I move ahead now ? Any tips?
I think you should sit down with the basic HTML file here:
And just start writing code in the main.js file. Find a really basic problem and try to solve it using the DOM as a UI.
Just starting to work on very simple problems with make you feel more comfortable to tackle bigger problems, and you'll be surprised how fast you'll go. Don't worry about any frameworks or choosing the right library or anything like that. Start getting stuff on your screen and changing it into something that solves something.