Assume Posted November 5, 2013 Share Posted November 5, 2013 This is a bad system as it only works with Windows. Also just use ObjectOutput/Input Streams to serialize and deserialze the object you store all the information in. If you insist on plain text, you can all use the Properties class. It generate more readable text than XML.System isn't bad... A platform dependent system running inside of a platform independent system is bad. Wait im confused what makes this only work on Windows?please clarify your statement It saves to C:/Users/USER_NAMELinux and Unix(Mac OSX) do not use this file scheme. LMFAO your joking right?You simply change the directory location (the string) honestly haha thats funny infact that has nothing to do with the function of the code itself, thats just telling the jvm where to put the file (Which your suppose to enter manually anyways) No, it should dynamically figure it out itself. It should not rely on user input. I was purely commenting on what was posted, not what was possible to be added. He should of used System.getProperty("os.name") and used a switch statement to convert the file location to the correct one. He did not do this so it is not compatible with any OS other than Windows in it's current form. Honestly because it is not your way, doesn't make it wrong/bad.It is perfectly fine and functional and can work on other machines with minimal editing (One string) You over complicated this more than it should If you want it to work on other machines all you do is change ("C:/Users/") in the locations to work with your machine getProperty("os.name") allows you to do this without the user selecting their OS. Obviously it is better. I don't use linux or mac. I have no need to check an extra line for something I never use. Anyone who scripts here, especially on mac or linux can figure out how to save files them selves. And last time I checked, OSBot has compatibility issues on mac. What you use is irrelevant. All that matters is what your users use. Link to comment Share on other sites More sharing options...
Dreamliner Posted November 5, 2013 Author Share Posted November 5, 2013 What you use is irrelevant. All that matters is what your users use. I have no users. I released my source out of the kindness of my heart. Care to give me pointers how to make it better? Link to comment Share on other sites More sharing options...
Assume Posted November 5, 2013 Share Posted November 5, 2013 What you use is irrelevant. All that matters is what your users use. I have no users. I released my source out of the kindness of my heart. Care to give me pointers how to make it better? He should of used System.getProperty("os.name") and used a switch statement to convert the file location to the correct one. Link to comment Share on other sites More sharing options...
hydragon Posted November 5, 2013 Share Posted November 5, 2013 What you use is irrelevant. All that matters is what your users use.I have no users. I released my source out of the kindness of my heart.Care to give me pointers how to make it better?Look at the system properties. There are few differences in how the path to the file looks between the different OSThis would be useful http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html Link to comment Share on other sites More sharing options...
Dreamliner Posted November 5, 2013 Author Share Posted November 5, 2013 What you use is irrelevant. All that matters is what your users use.I have no users. I released my source out of the kindness of my heart.Care to give me pointers how to make it better?Look at the system properties. There are few differences in how the path to the file looks between the different OS This would be useful http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html Not that, inefficiencies. What do you mean by serialize and deserialize objects? Link to comment Share on other sites More sharing options...
Assume Posted November 5, 2013 Share Posted November 5, 2013 What you use is irrelevant. All that matters is what your users use.I have no users. I released my source out of the kindness of my heart.Care to give me pointers how to make it better?Look at the system properties. There are few differences in how the path to the file looks between the different OSThis would be useful http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html Not that, inefficiencies. What do you mean by serialize and deserialize objects? You can save the User object you have created to disk in the exact state it is in and then deserialize it later on and it will be the same as when you serialized it. Link to comment Share on other sites More sharing options...
Dreamliner Posted November 5, 2013 Author Share Posted November 5, 2013 What you use is irrelevant. All that matters is what your users use.I have no users. I released my source out of the kindness of my heart.Care to give me pointers how to make it better?Look at the system properties. There are few differences in how the path to the file looks between the different OS This would be useful http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html Not that, inefficiencies. What do you mean by serialize and deserialize objects? You can save the User object you have created to disk in the exact state it is in and then deserialize it later on and it will be the same as when you serialized it. Interesting - I looked into it. Am I able to store it in readable form? From what I see, it gets saved as a bytestream and I use the xml data for other applications as well. Link to comment Share on other sites More sharing options...
Assume Posted November 6, 2013 Share Posted November 6, 2013 What you use is irrelevant. All that matters is what your users use.I have no users. I released my source out of the kindness of my heart.Care to give me pointers how to make it better?Look at the system properties. There are few differences in how the path to the file looks between the different OSThis would be useful http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html Not that, inefficiencies. What do you mean by serialize and deserialize objects?You can save the User object you have created to disk in the exact state it is in and then deserialize it later on and it will be the same as when you serialized it.Interesting - I looked into it.Am I able to store it in readable form? From what I see, it gets saved as a bytestream and I use the xml data for other applications as well. It won't be readable. Link to comment Share on other sites More sharing options...
Uber Posted November 8, 2013 Share Posted November 8, 2013 First off all, i would like to say that i do not consider my self a pro. i have only been programming for 7 weeks. but i wanna ask you a couple questions. Why do you, in your User class, have a contructer that calls on methods to setName etc? when you can simply have this.name = name; i dont se you use setName(method) anywher else in the code. so why do you have it there? In userManager you have an empty contructer wich is just bad coding.(Not a question) Why do you use random variables, such as un/db?(i mean c'mon db could be anything.. database to mention one ), if your make codes for public use please change those to something you understand insted of finding where you made those variables/objects. db = documentbuilde.. this Anyone who scripts here, especially on mac or linux can figure out how to save files them selves. - your qoute. How should anyone manage round the code and change anything, if the dont know what the variables stand for? Link to comment Share on other sites More sharing options...
Assume Posted November 8, 2013 Share Posted November 8, 2013 First off all, i would like to say that i do not consider my self a pro. i have only been programming for 7 weeks. but i wanna ask you a couple questions. Why do you, in your User class, have a contructer that calls on methods to setName etc? when you can simply have this.name = name; i dont se you use setName(method) anywher else in the code. so why do you have it there? In userManager you have an empty contructer wich is just bad coding.(Not a question) Why do you use random variables, such as un/db?(i mean c'mon db could be anything.. database to mention one ), if your make codes for public use please change those to something you understand insted of finding where you made those variables/objects. db = documentbuilde.. this Anyone who scripts here, especially on mac or linux can figure out how to save files them selves. - your qoute. How should anyone manage round the code and change anything, if the dont know what the variables stand for? In userManager you have an empty contructer wich is just bad coding.(Not a question) False. The compiler will add an empty constructor to the class on compile time if you don't have one. It is not bad code. db is a perfect name for a DocumentBuilder just as sb is a perfect name for StringBuilder. In context both of the names make perfect sense. Do you really want to type doucmentBuilder every time you want to use that object? Link to comment Share on other sites More sharing options...
Dreamliner Posted November 8, 2013 Author Share Posted November 8, 2013 (edited) First off all, i would like to say that i do not consider my self a pro. i have only been programming for 7 weeks. but i wanna ask you a couple questions. Why do you, in your User class, have a contructer that calls on methods to setName etc? when you can simply have this.name = name; i dont se you use setName(method) anywher else in the code. so why do you have it there? In userManager you have an empty contructer wich is just bad coding.(Not a question) Why do you use random variables, such as un/db?(i mean c'mon db could be anything.. database to mention one ), if your make codes for public use please change those to something you understand insted of finding where you made those variables/objects. db = documentbuilde.. this Anyone who scripts here, especially on mac or linux can figure out how to save files them selves. - your qoute. How should anyone manage round the code and change anything, if the dont know what the variables stand for? setName(string) is a setter and getter. It is actually good practice to use those. Eclipse adds them that way when you select add getters and setters for a method As said before, I usually abbreviate classes and then add a number or something memorable if I have more than one. writing db instead of documentbuilder1 5 times is way easier. Plus in my code, you can clearly see what the variable name comes from. db is obviously an abberviation of DocumentBuilder. It's not bad coding, it's actually good coding. And I was planning on putting an initializing thing inside of it then I realized I didn't have to. All methods - especially in c++ require constructors and destructors for adequate memory management. and if you know how to code, you should be well versed to follow what the variables mean. It seems to me that you jumped to the bottom of the code instead of reading all of it and confused yourself. Edited November 8, 2013 by dreamliner Link to comment Share on other sites More sharing options...
Uber Posted November 8, 2013 Share Posted November 8, 2013 First off all, i would like to say that i do not consider my self a pro. i have only been programming for 7 weeks. but i wanna ask you a couple questions. Why do you, in your User class, have a contructer that calls on methods to setName etc? when you can simply have this.name = name; i dont se you use setName(method) anywher else in the code. so why do you have it there? In userManager you have an empty contructer wich is just bad coding.(Not a question) Why do you use random variables, such as un/db?(i mean c'mon db could be anything.. database to mention one ), if your make codes for public use please change those to something you understand insted of finding where you made those variables/objects. db = documentbuilde.. this Anyone who scripts here, especially on mac or linux can figure out how to save files them selves. - your qoute. How should anyone manage round the code and change anything, if the dont know what the variables stand for? setName(string) is a setter and getter. It is actually good practice to use those. Eclipse adds them that way when you select add getters and setters for a methodAs said before, I usually abbreviate classes and then add a number or something memorable if I have more than one. writing db instead of documentbuilder1 5 times is way easier. Plus in my code, you can clearly see what the variable name comes from. db is obviously an abberviation of DocumentBuilder. It's not bad coding, it's actually good coding. And I was planning on putting an initializing thing inside of it then I realized I didn't have to. All methods - especially in c++ require constructors and destructors for adequate memory management. and if you know how to code, you should be well versed to follow what the variables mean. It seems to me that you jumped to the bottom of the code instead of reading all of it and confused yourself. about the empty constructor - java is build in such a way, that; if there is no constructors defined in the class then default (empty) constructor will be created automatically. so there is really no need to have an empty contructor in the code. If you have made a contructer with parameters, java does not automaticly create a defult one. in your code you only have on contructer(without parameters)...you dont use inhairitens, so i really cant se why you have it there. (again i have only been programming for 7 weeks. i migth be wrong, and if you think i am please tell me why so i know what i am talking about in the future) I know what the variable means, i wasn't specifly saying that db was hard to find, but in large snippets of codes, if you have random letters scattred around it hard to know what is what. you mentioned eclipse - it has a feature that, so you dont have to write DocumentBuilder everytime, you can just wirte doc and press Ctrl-Space. Personaly i dont think two letter variable is viable. Makes it easier for me and anybody else to read and understand the code. Link to comment Share on other sites More sharing options...
Assume Posted November 9, 2013 Share Posted November 9, 2013 First off all, i would like to say that i do not consider my self a pro. i have only been programming for 7 weeks. but i wanna ask you a couple questions. Why do you, in your User class, have a contructer that calls on methods to setName etc? when you can simply have this.name = name; i dont se you use setName(method) anywher else in the code. so why do you have it there? In userManager you have an empty contructer wich is just bad coding.(Not a question) Why do you use random variables, such as un/db?(i mean c'mon db could be anything.. database to mention one ), if your make codes for public use please change those to something you understand insted of finding where you made those variables/objects. db = documentbuilde.. this Anyone who scripts here, especially on mac or linux can figure out how to save files them selves. - your qoute. How should anyone manage round the code and change anything, if the dont know what the variables stand for? setName(string) is a setter and getter. It is actually good practice to use those. Eclipse adds them that way when you select add getters and setters for a methodAs said before, I usually abbreviate classes and then add a number or something memorable if I have more than one. writing db instead of documentbuilder1 5 times is way easier. Plus in my code, you can clearly see what the variable name comes from. db is obviously an abberviation of DocumentBuilder. It's not bad coding, it's actually good coding. And I was planning on putting an initializing thing inside of it then I realized I didn't have to. All methods - especially in c++ require constructors and destructors for adequate memory management. and if you know how to code, you should be well versed to follow what the variables mean. It seems to me that you jumped to the bottom of the code instead of reading all of it and confused yourself. about the empty constructor - java is build in such a way, that; if there is no constructors defined in the class then default (empty) constructor will be created automatically. so there is really no need to have an empty contructor in the code. If you have made a contructer with parameters, java does not automaticly create a defult one. in your code you only have on contructer(without parameters)...you dont use inhairitens, so i really cant se why you have it there. (again i have only been programming for 7 weeks. i migth be wrong, and if you think i am please tell me why so i know what i am talking about in the future) I know what the variable means, i wasn't specifly saying that db was hard to find, but in large snippets of codes, if you have random letters scattred around it hard to know what is what. you mentioned eclipse - it has a feature that, so you dont have to write DocumentBuilder everytime, you can just wirte doc and press Ctrl-Space. Personaly i dont think two letter variable is viable. Makes it easier for me and anybody else to read and understand the code. I guarantee you're shitty at programming. Just stop talking. Link to comment Share on other sites More sharing options...
bushhy Posted November 10, 2013 Share Posted November 10, 2013 Thanks! Im starting my first script and this is really helpful! 1 Link to comment Share on other sites More sharing options...