Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Dear people of stackoverflow,
I am learning to code Java and recently switched from programming in text editors and compiling in terminal windows to an actual IDE, NetBeans (I know, I'm a dinosaur. I inherited the habit from C++). The point is, I'm really lost.
I installed NetBeans because I saw some friends from school open the application and write about 50 lines of code in half the time it took me. I'm guessing they use some sort of templates or customized settings.
I would really appreciate it if you could shed some light in the subject, because I want to be as fast and efficient as possible when coding, especially when dealing with really long assignments.
This isn't something that can be quickly answered in this format.
The main advantages are:
Intellisense/Code completion (start typing code, press ctrl-space)
As-you-type error checking and reporting with automatic fixes in some places
Code generation (source->generate code)
Navigation (go to source, go to decleration, find references, etc).
Integrated debugging
Refactoring (renaming variables, methods and classes; introducing classes and methods; etc).
Try all of those things to get you started but there are many many more.
There's not going to be any one silver bullet; this is the accumulation of many small efficiencies, including keyboard shortcuts, advanced features, templates, etc.
You should take a closer look at what your friends do, and each time you see them doing something you don't, ask them about it. Better yet, each time you come across a task that intuitively seems like there should be a better way to do it (e.g. typing a similar pattern over and over), google around and see if there is a better way. There likely is!
For a more rigorous approach, of course, you can read the NetBeans manual end-to-end in order to get a comprehensive understanding of its features. I've never done that for my IDE of choice, though.
Ok, you have an IDE (that's good!). With it you can make a lot of shortcuts for developing. Here some tips:
You can create a project using a template by going File -> New Project -> <LANGUAGE> -> <TEMPLATE>. This template will autogenerate a basic source for what you want.
You can put breakpoints in any place only clicking in a line number.
You can debug by going to Debug -> Debug Project
You can auto-generate a double-clickable .jar by going to Build -> Clean and Build
You can run a console program directly in the IDE, by using Build -> Run Project
You can even install plugins for extending the IDE's functionality
There're lots of things I'm not telling you, cause it's a long list. You can see NetBeans Documentation for more info.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
Just looking for a basic answer as to where to start my project. First off, I am fairly new to java and all other languages so I'm no pro. I am just looking for an answer from anyone more knowledged than myself as to a sort of template for new projects.
I try and make new projects by myself to test what I have learned so far but often find myself extremely overwhelmed at the start of a project because I don't know where to start! I have so many keywords in my mind that I should be using to accomplish the goal of my project but can never figure out where to start wring the code!
What I am looking for is someone to just help me understand where I should/ how I should start a project?
Thanks in advance!
Alex Gunther
Someone down rated this question so I felt obliged to answer as its not a dumb question. When your first learning a language its a good idea to start out with simple executable and try and test what you know about the language. With Javascript that's the console in your browser, with Java that's the Main Method. Your initial few projects will all just be one class with a Main method, as your code starts to grow it will force you to learn how to refactor and create good classes and modularity. I also recommending take a basic beginner course on a sight such as Udemy.com as it will teach about necessary libraries and frameworks to creating meaningful code.
A project should always be started in your head, then if your serious, on paper. thinking out everything you will need, planning classes and variables and coming up with some pseudo-code (writing out what you think the code you will need looks like) are always the first steps.
if you are looking for some sample projects there are plenty of tutorial sites, that will run you through making different stuff step by step. this is a good place to start.
if your just looking to test your skills with Java check out CodingBat
but if you want a good place to start coding altogether, Download Unity3d, it supports c# and JavaScript (not to be confused with Java)
the reason i recommend unity3d is they have fully documented code for almost everything on their site, and lots of good video tutorials as well.
This is actually a great question. I would upvote if I could. I've felt the same when I was just starting out.
I usually make a rough plan of what I need on paper. What classes are going to serve what purpose and how do I want to structure them?
I then start to create the packages I use to structure and then the main classes. (My main() always just contains a call to a different funtion/object because I don't like static) From there I just build forward. The logic, then the interface and so on. I usually also structure the logic into different aspects.
Also you might want to make a priority list.
Here is my latest GitHub repo. This is just a snapshot of what my structure looks like at the moment.
if you use ECLIPSE:
FILE >> PROJECT >> JAVA PROJECT and give name to project >> finish
if you use NETBEANS:
FILE >> NEW PROJECT >> JAVA >> JAVA APPLICATION and give name to project >> finish
If you want more go to:
http://help.eclipse.org/photon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2FgettingStarted%2Fqs-3.htm
https://netbeans.org/kb/docs/java/quickstart.html
https://www.youtube.com/watch?v=ubwRUfvXJpE
https://www.youtube.com/watch?v=K3twuFyPwkg
if you want some video tutorials completely free search on youtube "JAVA video tutorial"
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I check out a java project to a folder. Someone told me that I shouldn't point the eclipse workspace to this directory.
Is there a best practice for this? Should you use the svn checkout dir or a dedicated one?
And why?
Thanks!
The reason why you shouldn't point your workspace to your existing files is because you want to keep the actual source files separated from your workspace settings.
The workspace that you're using has nothing to do with the code that you're writing so it's generally advised to keep them separated.
You shouldn't point the workspace directly to the directory of the checked out code. Say you have your workspace located at C:\workspace, then I would check out the project in C:\workspace\project.
On the other hand, it doesn't really make a difference of you would check out your code to another location, say C:\projects. Anyway, I don't see any bad practice with either way to do it.
I have seen, read and thought of different ways of using workspaces (per project, per application (multi-asseted or not), per program language, per target (web-development, plugins,..), and so on) and I am still doubting what the best approach is.
Can anyway give an elaborate, but not a page long insight into this?
This involves a lot of sub-questions, so to speak, and I don't know all the specific sub-questions I should ask, because I am not sure I don't know all the aspects of eclipse (and workspaces), but I'll try to give an example of what I am looking for:
What for?
What did eclipse development mean it to be used for?
What do other/most people think?
What do you think?
... ?
Why?
Are there configuration conflicts vs. sharing merits?
Any filespace reasons?
Performance?
... ?
Oh, and I am speaking of the minimum use case for a developer that uses different languages and protocols, and NOT necessarily all of them in one project (E.g. php, javascript and xml for some projects, C# for others, java and SQL for still others, etc..)
So you can choose any directory which you think is safe to keep your work. The main idea is to keep your all projects together.
Hope it will help you.
Or refer Create a new workspace in Eclipse
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
when every one of us program in java he would need a library (some jars) to complete his work .
so when this programmer find some libraries he need . how he can find the best of these libs ?
thanks.
I don't program in Java much but I do need to hunt down libraries for C++ and Python, which are my mainstays.
I think some criteria you can apply to stuff you find on Google or community sites like SO and java.net include the following:
How well documented is the project? Is it just API documentation? Does it have samples? Are they documented or just spat out? Are there tutorials?
When was the last stable/unstable/testing release? Do version control logs indicate activity in the project? (Google Code projects have a indicator on the right side of the page which shows project activity) Are their mailing lists active? Do a lot of people ask questions and questions get answered? Are developers talking on their mailing lists?
Is the API to your liking? This is both a matter of personal preference and objective measuring. As an example, for C++ GUIs, some people like the API of wxWidgets more, whereas some people like the API of Qt more, and there are people who are more productive in each, but there are also good reasons to believe objectively why one is better than the other API-wise.
Is the project "famous"? This is kind of iffy because it relies on groupthink, but there is some merit to considering projects based on how "famous" or "well-known" or "widely-used" they are. It helps because this is normally an indicator of reliability (emphasis on normally, i.e. not always). The communities will probably be more active and knowledgeable. You can tap onto existing programmers who are already probably familiar with these APIs and hire them or recruit them, etc. For example, I suppose that other than being generally quite good, a lot of people go for Lucene as their text search system because it is very widely used.
How mature is the project? Is it in alpha? Beta? Pre-release? Sometimes you find a library you really like but it's very raw. Depending on the nature of your project, you may want to reconsider using it.
All that said, generally good places to find good Java libraries are probably projects from Apache and those published by Google.
This is all I have for now. Take them with a pinch of salt. If I have anything else to add I will edit this post.
Hope this helps!
I rarely need additional "Generic" libraries. If that's what you are after you might keep an eye on the Apache stuff--there are a few groups like that that just do generally good work, but most of the stuff you could get in a general library like that you can write yourself just as quickly as you can learn to use their stuff.
Occasionally I need a specific library like an SNMP library or something to provide a specific service--these are actually NEEDed because rewriting them would be prohibitive. These are much more important to choose correctly, but generally there aren't so many to choose from and a co worker will almost certainly have some experience or opinions if you don't.
Researching stuff like this should be a scheduled part of every project--the need to do the research should be identified in the early phases of the project.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
what is the best way to understand a big company project in java?
There's a nice podcast/interview with Dave Thomas ("The Pragmatic Programmer" Dave) about this topic, here.
He calls it "software archaeology".
For many different reasons organizations frequently lose control of their code bases. Knowledge gets forgotten, people leave. One could very easily mistake the code base for an archaeological concern were it not for the fact that mission critical applications built upon it keep chugging along until something needs to be modified or enhanced and then suddenly you have a vat of source code that no one understands but that has become the most important thing in the world overnight.
There are very few short cuts for coming to terms with big vats of code. Generally, one has to balance the quest for "understanding it" with the pressure to make pointed pragmatic changes to "complete the mission".
You'll never know every line of every piece of code at a company. What you CAN do is understand the classes, what they do, and how they relate to each other.
Start by getting the most basic understanding of the way the code flows from a class perspective focusing on the large classes that do that majority of the work. Once you understand what's happening there start focusing on smaller classes. Keep this up until you have a pretty good understanding of a handful of classes.
Additionally you can break it down in to common programming tasks that your company has. Once you have a list of these research what's involved in implementing each of them.
The final thing is just experience. You can study the code as long as you want, but there's no substitute for playing with the actual code. Writing programs, testing things out, and looking at how existing code runs are the best way to learn a new system.
Start writing unit tests - you do something useful (which will probably earn you more time to understand the code) and you get an in-depth look into the functionality. Also, start asking questions when they come up during that process, you will be able to ask very specific questions and you might impress your colleagues :)
Few places I often start from is the build/package/deploy scripts and configuration files - depending on the size of the application we are talking about, they can tell you a lot about the internal structure, external dependencies and highlight things to dig in further.
Next you can use code coverage tool and record the coverage for a simple scenario, which points roughly which areas are performing it. A variation of this is running under tracing profiler. Heap dumps are also useful for getting an idea of the basic data structures.
Finally, look application logs during various scenarios, though these are usually too much information and you need to know what are you looking for.
All these should give you a good idea of the overall application. After that, you need to fire up a debugger and start poking in the code. Ask your colleagues for their favourite breakpoint locations - usually everybody has some.
In case you are doing Java or C#, make sure you know your IDE and how to use find-usages. There are further more advanced tools for static analysis and comprehension like Structure101 (my favourite), SonarJ or LattixDSM.
Some UML reverse-engineering tools can generate class diagrams, but usually they create too much noise and doing the pruning manually assumes you can discern the important from the unimportant (which usually is not the case with new codebase). If you get one of these, I recommend starting with essential class and using the "Add dependencies" functionality to incrementally explore the application.
Take a simple first task, and don't rush anywhere. Look around, use the time to learn and understand the environment. Examine the call stack, use a debugger. And when you have a solution, ask your peers for a code review, and learn from them.
Then take another task, and another one, and another...
You'll get there soon :)
Documentation my friend, look for manager patterns seek the jsp play with the code dont be afraid to make small changes and see what happens, understand the logic and the building blocks, stay way from companies with poor documentation.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Most of the time I have been programming little apps either for myself or for the benifit of learning. Now that my programming skills are considered somewhat intermediate, I was wondering how I would tackle a large programming project.
Lets suppose I wanted to make an application that has a lot of features and is intended for the use of others and not just myself; how do I go about planning for such projects?
Do I just jump in and start coding the thing or is there some sort of recommended process?
Thanks in advance :D
Although Steve has a good recommendation, I think that answer is probably a bit beyond where you are at.
The "simplified" version of how to go beyond what you've been doing is:
gather requirements from the users. Write them down in terms of required functionality.
Do simple screen layouts. The main part here is just to get functionality grouped into the right areas.
Build a data model
Build the actual screens and tie them to the data model.
Iterate with more features.
At each point stop and do a reality check. For example, do the screens make sense? Is the information organized in a good way? What areas might you have a problem in? etc.
Above all, stay in communication with the people that will actually use this product.
Also, their are two keys to a successful project. The first is to break it down into manageable portions. In other words break it up so that you can deliver each piece quickly, call that piece done, and move to the next. This will help you to stay focused and not get in over your head.
Second, work with what you know. When moving up, refrain from taking this as an opportunity to expand your coding skills. Instead, your focus here is going to be on learning project management.
After you've done one or two iterations of this, then look into the various software development methodologies such as scrum, waterfall, etc and see what they have to offer you.
Good luck!
Some of the things your going to want to look at is a tool chain including source code control, unit testing, documentation, automated builds, continuous integration, bug tracking etc. Programs at this level become very complex very quickly. So you definitely don't want to just start coding. you are going to want to develop a list of things the program should do. Then refine this list to must haves, would be nice and in a perfect world. From this list you can start designing a database schema, screen designs, and a class structure (assuming OOP).
This book is based on web applications, but much of it applies equally well no matter what language you are working with:
http://www.amazon.com/Developing-Large-Web-Applications-Producing/dp/0596803028/ref=sr_1_1?ie=UTF8&s=books&qid=1273632445&sr=8-1
You will also want to think about communication, most applications at this level of complexity are not the product of a single person, but rather a team. As a result effective communication and teamwork, become very import considerations.
This is by far not everything you will need to create a successful product, but should start you in the right direction.