So integrated developmentenvironments, or IDEs, do real programmers use those? So I’m talking about IDEs in general like IntelliJ IDEA, NetBeans, Eclipse, PyCharm, Visual Studio, Visual Studio Code althoughthat’s more of an editor, Code::Blocks, CodeLite, and a tonne more. Literally, there’shundreds, if not thousands, of IDEs on the market. So do real pro programmers use IDEs for their everyday programming, or do they focus on the command line and doing everything from that interface? Let’s talk about that in today’s video. This video is brought to you by the Learn Programming Academy’s Mastering Intellij IDEAand Android Studio course. Instantly become more productive and learn to get themost out of IntelliJ IDEA and Android Studio with this course. Visit lpa.dev/YoutubeIntelliJ, or click on the link inthe description below. (upbeat electronic dance music) Welcome back, my name is Tim Buchalka with another Programming Tip of the Day, and we’re talking aboutwhether real, quote, unquote, pro programmers, whether they use IDEs that look like this for typing in their code and programming or do they use commandline tools, terminal, I mean, basically the commandline with terminal tools that look like this? Now, I’m gonna preface that by saying that I started out back inthe 1980s programming when there were no IDEs, so my experience, I hadto code from effectively what is the command line anyway, and that’s because thereweren’t any other choices, but these days, we’re spoiled for choice when it comes to ways to programme. So what I wanna do isshow you the difference.
We’re gonna start out by looking at some common tasks in an IDE, and I’m going to dothe same thing manually from the command line. We’re gonna use theWindows Subsystem for Linux on Windows 10 to show thedifferent way of coding, and hopefully from there,you can then figure out which way you think you should be using whether you wanna use theIDE or the command line, but then, we’ll also have a discussion at the end of this video about what pro programmersactually use in general, and we’re gonna be usingIntelliJ IDEA as I mentioned and also the Windows Subsystemfor Linux command line tools that I’ve optionally installedas part of Windows 10. All right, so basically let’sstart now on the first thing. That’s four things I wanna go through and show you the differences. The first one is creatinga new Java class, so I’m gonna go through the process of creating a brand newproject from scratch in IntelliJ IDEA, create that new class, a simple class that’sgoing to have some fields and does some access methodsas well as a constructor, and then we’re gonna do the same thing with a command line interface, so let’s dive into that right now. Okay, so here we are in IntelliJ IDEA. Let’s create a new project. Okay, I’m gonna select Java. Next, I’m gonna deselectboth options there so we type the code in, and TestProject I’m gonnause as the project name, and if I can type, I’ll just correct that. Okay and click on Finish, and IntelliJ is creating our project. Now, just a reminder thatwe’re creating a class here. We’re gonna create a Customer class, some accessor methods thatsupports the constructor and then do the same in the command line using the Windows Subsystem for Linux, which is basically justsort of like a Linux shell which you can use with Windows, so you could be following along and doing the same thing inLinux or any other command line.
All right, so let’s expand this out. We wanna right-click this src folder and create our Customer class. So right-click, right, New, Java Class, and I’m gonna type in the package as well, academy.learnprogramming.Customer, so that’ll create thepackage automatically as well which is a nice little feature. All right, so now, weneed to add our fields. Gonna add two fields, so first one, private String name. Second one, private int accountNumber. Write some getters and setters. Let’s use to Generate functionto generate some code for us. Generate, Getter and Setter. We’re to select both there, and there’s that code. Let’s now create a constructor, so we’re gonna use Generator again to create a constructor for us, and bang, there’s ourbasic boilerplate code, and you can see that was fairly quick, and we didn’t have toreally do too much at all. So let’s now swing over to theWindows Subsystem for Linux and do the same from the command line. All right, so here,we’re at the command line in the Windows Subsystem for Linux. I’m creating a folder firstly. I’ll call that programming, and then we wanna have a subfolder, and we’ll call it testproject. All right, so now we needto create our src folder. That’s where our code’s gonna go, but we need to createthe package manually, so that’s going to be academyas a folder or a directory and a subfolder learnprogramming. You can see the IDE did that all for us, but we have to do that manually.
Now we’re in that path there. You can see the path on the screen. I’m going to go intoCustomer.java using vi. We’ll create a file called Customer.java. All right, so packagelearnprogramming.academy semicolon, then public class Customer, left to right curly braces. Next, we wanna add our two fields, private String name. Then private int accountNumber. All right, so next, we needour getters and setters. Well, actually, let’s createour constructor first, so public Customer, left parentheses, String name comma int accountNumber, right parentheses, leftto right curly braces, and assign the values now. this.name equals name, this.accountNumber equals accountNumber, so that’s our constructor, and now, we’ll add ourgetters and setters. So I’ll start with a getter for name, so public String getName, parentheses, left to right curly braces, and you just wanna returnname, being our field. Now we’ll add a setter,so public void setName, left parentheses, Stringname, right parentheses, left and right curly braces, this.name equals name. All right, same for accountNumber, public int getAccountNumber, left to right parentheses,left to right curly braces, and return accountNumber, and the same for the setter, so public void setAccountNumber, left parentheses, intaccountNumber being the argument, right parentheses, leftto right curly braces, and then this.accountNumberequals accountNumber. All right, so that’s ourbasic class now created using Windows Subsystem for Linux. I wanna show you some errors or how errors are shown in an IDE.
So actually, that was abad example, wasn’t it? We’ll change this one here. Now, notice when I change that and reference a field that doesn’t exist, we get an immediate error. That’s another bonus of using an IDE. You know straightaway without compiling that there’s a problem. Now contrast that to making the change at the command line level here. She’ll do, and we’ve got no idea thatthere’s an error there, and we won’t actually know until such time as we compile our programme, so that’s another thing thatcan take a bit more time, but I’ll save that now, so I’ve now got the command line version and the IDE version. Let’s go back to the video. All right, so that was interesting. That’s the first task completed. For the next task, what we’re gonna do iscreate another class, a second class for our mini-project. We wanna do that in IntelliJ first, and then, we want to compileand run our application. So the second class is goingto have a simple mechanism to basically access that firstclass and then run something. So we’re gonna do that, compile it and run it afterwe’ve added the second class, and then, we’re gonna do the same thing from the command line as well, so let’s have a go at doing that now. Okay, so back in IntelliJ, let’s start by creating a new class. I’m gonna right-pick thelearnprogramming package and select New, Java Class. This one, I’m gonna call Main. Now, we’re going to create a start method or main method, rather. You can notice that Idid psvm as a template, and it created that for us automatically. Customer customer equals new Customer, left parentheses, and first argument indouble quotes is Tim, the second argument, 12345, and we’ve got a System.out.printlnon the next line. Then a String.format in the parentheses, and in the arguments, Customer Name colon, %s being a string, then Account #, then the colon sign andthe %d being an integer.
Then we need to pass the two parameters, customer.getName,customer.getAccountNumber. So basically, state thecustomer name and accountNumber. We’re gonna output, so let’s run it, and we’ve got an error there because I didn’t fixit up from previously, so let’s delete that. So now, I’ve got a validaccount name again, and again, the IDE helpfullyshowed us really quickly where the error was. Let’s run it again. We can see we’ve now got the output, Customer Name: Tim Account #: 12345. So that was still fairly productive. Let’s go have a look atthe command line version. So I need to create a class, so vi Main.java. You’ll need to type this manually, so packageacademy.learnprogramming semicolon. Let’s create our class, public class Main, leftto right curly braces. Now we need to type in our Main method, so public static voidMain, left parentheses, String, left and right curlybraces or square braces, args. Then we’ve got the right parentheses and left and right curly braces, Customer customer equals newCustomer, left parentheses, and we’re gonna use thesame arguments here, so it was Tim. Let’s put that in double quotes, and comma, 12345 being the accountNumber. All right, let’s format this out. So System.out.println, left parentheses, and we’re gonna use String.format, left parentheses, double quotes, Cust, we’ll use the same thing, Cust Name colon, %s for a string, Account # colon, %d, then a double quote, comma.
Then we’re gonna use customer.getName, left to right curly braces, or left to right parentheses rather, and we’ll put them on the next line and do the same for accountNumber. So customer.getAccountNumber, left to right parentheses, and just close off the lineand put a semicolon on the end, and that should be our main method. We should now be able to run this, so let’s have a look at doing that. Let’s compile it. So we need to go down to thesrc folder to compile it, and then, we need toissue the javac command. So javac, -cp for class path, period, the current class path. We need to specify the path, academy/learnprogramming/Customer.java. Let’s try that first, and we’ve got an error because we changed the accountNumber, so let’s navigate into that folder. vi academy/learnprogramming,then Customer, and delete the two there to make it valid. All right, let’s trythat compilation again. This time, we’ve got no output. That’s good, it’s worked, and do the same for Main.java. We’ve got an errorthere, so what did we do? We missed the rightparentheses, so let’s edit that. Know that the IDE would haveactually picked these up. It would’ve seen thered error straightaway, but in this case, we’ve had to go through and do it. I’ll add the right parentheses there. Save. Recompile. When we’re done there, ah, okay, let’s fix that. Ah, package name was wrong, of course. It was academy.learnprogramming.
I typed it in as learnprogramming.academy. That’s another thing theIDE would’ve picked up. Let’s fix that, so it’s academy.learnprogrammingis what it should’ve been, and that was obviouslythe same in the IDE. We save that. Third time lucky? Let’s try it again. This time, we’ve got Customercompiled and Main compiled. Let’s now run it from the command line using the java command. Clear the screen. I’m now gonna rerun it. java academy slap, dot rather, learnprogramming.Main, and there’s the same output. Yep, there it is, so we’re good to go. All right, so that’s thesecond class done now. The third task I wannalook at, task number three, is renaming two things. Firstly, renaming the classitself, the class name, and then, also a field inthe actual class as well and see how to do that in the IDE and then also how to do that from the Windows Subsystem for Linux, effectively from the command line. Let’s have a go at doing that right now. Okay, so let’s go ahead now. We wanna rename the class, so we’ll rename Customer. So I’m going to come overhere and right-click, and to do it here, yeah, right-click, Refactor, Rename, and change this to CustomerDetails. You notice that it’s changingit in multiple places for me. We’ve got the option tooverride the name there which I’ll leave for now and click OK, and that’s also changedthe Main.java call as well, so you can see that’s very easy. It’s updated theCustomerDetails there as well as what we change in CustomerDetails. All right, so let’s now chain, and we’ll just run itto make sure it works. Let’s change the name to firstName. Refactor, Rename, firstName, and you’ll notice carefullywhere it’s changing things here. It’s changed the getter. It’s asking to change thegetters and setters as well. Absolutely yes, and let’s change theparameter name this time, just to see how that’s changed and just makes it a lot easier. It’s changing the constructorand the getters for us, and it’s all done veryquickly as you can see, and it’s quite easy to set that or to basically make that change. Let’s swing over now toWindows Subsystem for Linux and do it on the command line. You saw that I run and it worked okay. So we’ll go into the src folder first, into the academy.learnprogramming file, and the first thing we wannado is we won’t edit it.
We need to move it, sowe need to rename it. Move Customer.java toCustomerDetails.java. mv is move in Linux. So we now, we want itto be CustomerDetails, so CustomerDetails.java is the file. Let’s edit that. We’ll change the classname to CustomerDetails. We also have to change the constructor, and I’m clicking there, but of course, the mousewon’t work in this editor. (chuckles) I need tomove the mouse manually, or the cursor manually. So there’s CustomerDetailsfor the constructor name. Then we also have to say wenow need to go into Main.java and change it there as well because that’s referencingthe old name Customers, so let’s make that CustomerDetails. CustomerDetails again. All right, so now, let’s go back down to our src folder and compile this and change, we’ll compile Main first. Then compile, oh, I should just type it, CustomerDetails.java. All right, let’s run this tomake sure that it still works. academy.learnprogramming.Main, capital M. That’s working. All right, let’s go backinto the src folder again, academy.learnprogramming and edit CustomerDetails again ’cause this time, of course, we need to rename the field. So we’re gonna rename thename field to firstName. Let’s go ahead and do that, and it’s bit of a slog here ’cause you can seethere’s a lot of places, a constructor parameter, the constructor itself. this.name has to bethis.firstName equals firstName. The getter, getFirstName now, and returns firstName. So this is boilerplate code, and it’s quite frustrating. Just a waste of time, so I can setFirstName, String firstName, this.FirstName equals firstName. Now, we could automate some ofthis with a copy and replace, but usually the copy and replacedoesn’t get it all perfect. Thus the change is made. Let’s go back and make the change there because we need to changethe getter to getFirstName because that’s how we’re accessing it. Now we’ve done that, we should be able to compile this now. Okay, and we’ll do Main as well. All right, let’s run it, java academy.learnprogramming.Mainwith a capital M. All right, so that’s work.
That’s the command line version. What I notice is Customer.class. It wasn’t cleaned up for us. When we renamed the class,we moved it to a new name. Now if we go back to the IDE, you’ll see that it’s gotits own directory structure for class files. It doesn’t lump them together, and it’s automaticallycleaned up the old name when we renamed it. That’s something that doesn’thappen from the command line, and again, there it is. All right, let’s move on. All right, so the lasttask, task number four, and it’s a pretty simple one, we just want to undo the third task. So basically we wanna undothose two renames we did, the first rename at the class level, then also the field that we renamed which obviously, you saw inthe video, had consequences and that we needed to change other things to get that to work. So let’s look at howto do that in the IDE, IntelliJ IDEA again, and then do that fromthe command line as well. All right, so we’re now gonna go through, and I’ll swing over to the IDE. Let’s undo the changes, and I’m just gonna press Control + Z here and keep pressing Control + Z, and it’s gonna undo the changes for us. So Control + Z, and it’s telling us do we wannaundo the renaming the field? Yes and notice that it’sundone all the changes. I’m pressing Control + Z again. There’s the other changesand one more time, and the class rename has been undone. Now notice over herein the output package, it’s still got CustomerDetails, but if I run this programme again which’ll effectively compile it, you’ll note that that willget updated to the new name. So let’s run it, and notice it’s been updated, so it’s cleaned up foritself after itself, which is pretty cool. So trivial to do in an IDE toundo any changes you’ve made. Let’s swing over to the command line, and actually, I won’t show this now, but you can see that this wouldbe quite an involved process to undo what we’ve done.
We have to undo what you sawme do previously in reverse, so I won’t do it now, but you can see it would bequite cumbersome, all right? So let’s move back to the video now. All right so that’s four tasks, and I just wanna say that there are ways to optimise the command line to make it a little bit more productive, but what I’m reallytrying to point out here is in general, I thinkyou’d have to agree, looking at those two ways, that the IDE approach was more productive. In other words we’regetting more things done in the same time frames, and given the same amount of time, we can almost certainly produce more code in IntelliJ IDEA in the IDE asopposed to the command line. Now the reason thisvideo came about is that I actually get this occasionally, and this is something that used to be far more prominent years ago, that some programmers feel that an IDE holds the programmer’s hand too much or generates too much code for you, and they don’t feel like they’re a, quote unquote, real programmer because they’re actuallydealing with an IDE instead of the command line, but the thing to remember is that the generation of thiscode is boilerplate to code, as I call it, which is commoncode that we use every day, should be left to a computer, right? We want the computer toperform those mundane tasks so we don’t have to do them, and we can actually focus on tasks like the functionality within a programme instead of having to writethis extra boilerplate code that you saw me having to write manually when we’re actually usingthe command line version in this video. So IDEs, integrateddevelopment environments, bring with them a huge range of benefits, but probably the main one, and one that I hopefullyhave showed in this video, is productivity.
You can really get more done in less time, and it’s just a little bit easier to go through the whole process. So geekiness aside, what does the average boss or client want from you as a programmer? Well, they want code that is good and reliable and actually works, but surely, they want it in the shortest amount of time, right? So in general, and IDEskinda give them that, so basically, yeah, by using an IDE, you’re gonna be able to providecode quicker in general, and I’m generalising here, to your boss, to your client, and to your users whenit comes down to that. So my take on this personally is that a real programmerserves their audience, but then, that’s the audience is the boss, the client, the user. An IDE gets stuff done faster, so your focus shouldreally be on your audience and delivering them a solution and not what makes you feel good or makes you feel like, you know, whether you’re a real programmer or not. Now, IDEs, the realityis that they usually, you’re going to be gettingless errors during development if you’re taking advantageof all the various debuggers and online components of a typical IDE which will do things likeshow you an error immediately so you don’t have tocompile it to see the error, and the debugging tools are pretty good compared to the command line versions. It’s just an easier-to-useinterface in general compared to the alternative. So basically, what I’m saying is focus on the needs of your audience and not your own needs whenit comes to programming, and for that reason, Isuggest you use an IDE, and by using an IDE, youcan be more productive, get things done quicker, and ultimately, you’regonna keep your boss, your client, and your users happy with the services you’reactually rendering to them. All righty, so I hope that helped. If you got any questions, feel free to leave a comment, and I’ll get back to you. If you’re ready to look at the next tip, click on up here andyou can check that out. If you’re interested incoding-specific programming videos, click on the link in thebottom left-hand corner Consider subscribing byclicking on the link up here, and I’ll see you soon.