• Post Reply Bookmark Topic Watch Topic
  • New Topic

saving code states  RSS feed

 
Mike Tyler
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

recently I was playing a lot in Eclipse, testing util classes, randomisation etc.
But always when I wanted to keep something for future reference, I had to either comment it out or start a whole new class, copy all the code and change just that little thing I was testing.

I was wondering if it's possible to actually save just the 'current state' of the code. The idea came back from my days when I was working with 3ds max and I saved the scene periodically so I could revert back anytime I messed up something.

I was looking into Object Serialisation and JUnit testing for this purpose, but that's just too complicated.

Is there a way in Java (Eclipse) to accomplish such thing?

 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Get familiar with one of version control systems available.
I believe the most popular one right now is git.

Object serialization will allow you to save a state of an object, not a source code.
 
Mike Tyler
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paweł Baczyński wrote:Get familiar with one of version control systems available.
I believe the most popular one right now is git.

Object serialization will allow you to save a state of an object, not a source code.

ok, thanks. It also seems to be kind of complicated, but I'll try to look into it some more.
 
Knute Snortum
Sheriff
Posts: 4288
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike Tyler wrote:It also seems to be kind of complicated, but I'll try to look into it some more.


Are you a professional programmer (or planning to be)? If so, learning git will be very useful to you. Also, there's a git plugin for Eclipse.
 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would certainly back Knute up on the value of learning an SCM (Software Configuration Management) tool such as git. However, be wary of the Eclipse plugins. I have had mixed results with them and when they go bad, oh boy do they make a mess. My recommendation is to stick with the terminal interface, certainly initially, possibly forever.
 
Campbell Ritchie
Marshal
Posts: 56598
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or try SVN; here is a nice tutorial about it.
 
Mike Tyler
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the input.
As you mentioned, I believe git would be quite a useful tool in a corporate environment, within a production team.

I am just starting out and don't intend to be a professional coder (hopefully ). But I might give Egit a go when I have some spare time...
 
Stefan Evans
Bartender
Posts: 1837
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using a source control tool like git/svn would do what you are after.
Taking a snapshot/backup of your code by copying it manually would also work.

Eclipse also maintains a "Local History" of changes to files. You can compare your current version against any version in the history, and recover the old one if you so wish using "Replace With"
Just right click any file in your project and look at the "Compare With" and "Replace With" options in the context menu.

 
Mike Tyler
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan Evans wrote:Using a source control tool like git/svn would do what you are after.
Eclipse also maintains a "Local History" of changes to files. You can compare your current version against any version in the history, and recover the old one if you so wish using "Replace With"
Just right click any file in your project and look at the "Compare With" and "Replace With" options in the context menu.


this is exactly what I had in my mind.. thank you!
 
Jayesh A Lalwani
Rancher
Posts: 2762
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mind you that it doesn't keep local history forever. Eclipse is not a source code repository and doesn't pretend to be one. The local history tab is meant for you to look at changes that you have done recently
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!