IDE's for Java, C
Total Page:16
File Type:pdf, Size:1020Kb
1 IDE’s for Java, C, C++ David Rey - DREAM 2 Overview • Introduction about IDE’s • Eclipse example: overview • Eclipse: editing • Eclipse: using a version control tool • Eclipse: compiling/building/generating doc • Eclipse: running/debugging • Eclipse: testing • Eclipse: tools to easily re-write code • Conclusion 3 What is an IDE • IDE = Integrated Development Environment • IDE = EDI (Environnement de Développement Intégré) in French • Generally language dependant (c/c++ specific IDE, java specific IDE, not yet good ones for Fortran) • Typical integrated development tools : • editor (with auto-indent, auto-completion, colorization, …) ; • version control ; • compiler/builder ; • documentation extractor ; • debugger ; • tests tool ; • refactoring tools. 4 What is not an IDE • Just a great text editor • A code generator • A GUI designer • A forge (i.e. GForge) 5 IDEs examples - Java • Eclipse (http://www.eclipse.org) • JBuilder (http://www.borland.com/us/products/jbuilder/index.html - free for personnal and non-commercial use) • NetBeans (http://www.netbeans.org/) • JCreator (http://www.jcreator.com/) • … 6 IDE’s examples – C/C++ • Visual C++ - com. license (http://msdn.microsoft.com/visualc) • C++ Builder - com. license (http://www.borland.com/us/products/cbuilder/index.html) • Quincy (http://www.codecutter.net/tools/quincy/) • Anjuta (http://anjuta.sourceforge.net/) • KDevelop (http://www.kdevelop.org/) • Code::Block (http://www.codeblocks.org/) • BVRDE (http://bvrde.sourceforge.net/) • RHIDE (http://www.rhide.com/) • … 7 Overview • Introduction about IDE’s • Eclipse example: overview • Eclipse: editing • Eclipse: using a version control tool • Eclipse: compiling/building/generating doc • Eclipse: running/debugging • Eclipse: testing • Eclipse: tools to easily re-write code • Conclusion 8 Eclipse software • Foundation: http://www.eclipse.org & http://www.eclipse.org/org/index.html • Downloads at http://www.eclipse.org/downloads/index.php • Common Public License (CPL): • http://www.eclipse.org/legal/cpl-v10.html • royalty free source code / world wide redistribution rights • Supported languages: Java, C++, python, … • Supported platforms: Linux, Windows, … (java software) • Many tutorials on the web • A good one (in French): http://perso.wanadoo.fr/jm.doudoux/java/dejae/indexavecframes.htm 9 Eclipse “philosophy” • Extensible with java plug-ins • May be used with several programming languages via plug-ins • Many specific extensions via plug-ins • Aim: software factory • MDA • Code generation 10 Eclipse main features • Powerful editing mode • automatic indentation • search/replace • auto-completion (classes, methods, …) • … • Version control • CVS • Compiling/building • its own system • ant • Debugging • its own debugger • Testing • JUnit • Refactoring 11 Overview • Introduction about IDE’s • Eclipse example: overview • Eclipse: editing • Eclipse: using a version control tool • Eclipse: compiling/building/generating doc • Eclipse: running/debugging • Eclipse: testing • Eclipse: tools to easily re-write code • Conclusion 12 Editing with Eclipse: main functionalities 13 Edition with Eclipse: demonstration • Open a project of vehicles: • Contains simple class MotorizedVehicle • Contains a first inherited class Car • Contains a second inherited class Motorcycle – Indent properly class Motorcycle • Contains class TestVehicles with a main function • Other manipulations: • Create new class Plane with inherited methods • Show that changing class name warns if file name is not changed • Add a task in the border • Change the javadoc comments for the file and class • Remove corresponding tasks • Add specific attribute: private float altitude • Add javadoc comment • Show javadoc preview in the bottom window • Automatically add constructor using fields • Show Brackets matching in the border • Show show/hide button in the border • Automatically add getters and setters • Add specific methods goDown and goUp: show automatic completion with this.setAltitude 14 Overview • Introduction about IDE’s • Eclipse example: overview • Eclipse: editing • Eclipse: using a version control tool • Eclipse: compiling/building/generating doc • Eclipse: running/debugging • Eclipse: testing • Eclipse: tools to easily re-write code • Conclusion 15 Configuring CVS access • Check compatibility with CVS version http://dev.eclipse.org/viewcvs/index.cgi/platform-vcm-home/docs/online/html-cvs/cvs-compatibility.html?rev=1.3 • Window • Open Perspective ® Other • In CVS Repository • Click on “add cvs repository” 16 Using CVS in Eclipse: demonstration • Checkout an existing project (e.g. dream web pages) • Modify this project (e.g. add a comment in a web page) • Commit changes 17 Overview • Introduction about IDE’s • Eclipse example: overview • Eclipse: editing • Eclipse: using a version control tool • Eclipse: compiling/building/generating doc • Eclipse: running/debugging • Eclipse: testing • Eclipse: tools to easily re-write code • Conclusion 18 Configuring compiling/building • By default, an Eclipse project is compiled internally • Project ® Properties 19 Using compiling/building: demonstration 20 Using a build.xml • It is possible to use ant with xml build files • For specific build tasks • To set a given version of the compiler, javadoc, … • To set specific parameters for building (i.e., on a shared project with people not under Eclipse, …) • Cf. Ant and Eclipse tutorial: http://perso.wanadoo.fr/jm.doudoux/java/dejae/chap009.htm#chap_9 • Cf. Ant documentation: http://ant.apache.org/manual/index.html 21 Configuring javadoc • Give path to javadoc at the first go 22 Configuring javadoc (2) 23 Generating javadoc: demonstration 24 Overview • Introduction about IDE’s • Eclipse example: overview • Eclipse: editing • Eclipse: using a version control tool • Eclipse: compiling/building/generating doc • Eclipse: running/debugging • Eclipse: testing • Eclipse: tools to easily re-write code • Conclusion 25 Configuring run/debug 26 Running a java class: demonstration • Run a class • Change parameters and run again 27 Debugging: demonstration • Show run/debug menu • Add a line breakpoint • Add a method breakpoint • View variable value 28 Overview • Introduction about IDE’s • Eclipse example: overview • Eclipse: editing • Eclipse: using a version control tool • Eclipse: compiling/building/generating doc • Eclipse: running/debugging • Eclipse : testing • Eclipse: tools to easily re-write code • Conclusion 29 Configuring JUnit • JUnit is a part of the Eclipse project by default • For more details on how to configure and use JUnit in Eclipse look at http://perso.wanadoo.fr/jm.doudoux/java/dejae/chap010.htm#chap_10 30 Using JUnit: demonstration • Add a class test for class Motorcycle • Show Class test for Car • Show how to run tests • Modify a test to make it fail 31 Overview • Introduction about IDE’s • Eclipse example: overview • Eclipse: editing • Eclipse: using a version control tool • Eclipse: compiling/building/generating doc • Eclipse: running/debugging • Eclipse: testing • Eclipse: tools to easily re-write code • Conclusion 32 Tools to re-write code: main functionalities 33 Tools to re-write code: demonstration • Changing a class name • Changing an attribute name • Changing a method name • Changing a method signature • Moving a method to another class 34 Overview • Introduction about IDE’s • Eclipse example: overview • Eclipse: editing • Eclipse: using a version control tool • Eclipse: compiling/building/generating doc • Eclipse: running/debugging • Eclipse: testing • Eclipse: tools to easily re-write code • Conclusion 35 Conclusion IDE’s: • Exists for many platforms and programming languages • Java (e.g., Eclipse) • C/C++ • Is useful for beginners as well as for experts • Is time consumable at the beginning • Learning curve • Several tools need configuring • Saves time when often used: • Powerful editing mode • CVS plug-in • Code generation • Easy compiling/building/running, related to source files • Easy refactoring • Still evolving and will be used in the future for • GUI designer • MDA approach.