11-25-2014
|
20 | |
Banned
Join Date: Jul 2014
Location: Omaha, NE
Posts: 610
|
Not only does that code have NOTHING to do with hacking, your comment is not original. I clearly stated AND put it in a spoiler for the fact that it's, as stated, bad practice. Maybe rather than taking your grudge out on me for being better than you'll ever be, you can remove your account and swim onto the worthless life ahead of you. |
|
11-25-2014
|
22 | ||
The muffin man
Join Date: Sep 2011
Location: Burger Refuge
Posts: 2,262
|
This will be my only reply to this matter.
Your code doesn't teach anyone anything given the layout of your solution. It's not intuitive at all and definitely doesn't promote the OO paradigm like it should. I'm saying all this since C++ is an OO language itself and it's better to have someone write code properly from the start than become exposed and learn from solutions that may suggest otherwise.
How about instead of posting your code you really prove your knowledge and promote a code design that encompasses desirable attributes, maintainability being a big one... efficiency wouldn't be bad either. Please, go ahead and read up on this sort of stuff.http://msdn.microsoft.com/en-au/library/ee658094.aspx If you want to further continue this conversation don't bother replying in this thread, instead take it to facebook or pms. Cheers mang. ???? @Motorox and any others who are wondering what I'm on about.. In object oriented languages, responsibility of each object should be specific and clear with each object's functions performing a clearly labelled task and nothing else. In fysez's example, one object's method is responsible for everything. This makes it unclear when debugging as to which component might have stuffed up. And.. what if we wanted to add something new!? Yes, the scale of the code at the moment makes this scenario not as bad as you might think and this argument seem petty but, as with anything, this can easily grow out of hand. |
||
11-25-2014
|
24 |
Banned
Join Date: Jul 2014
Location: Omaha, NE
Posts: 610
|
I'm not going to read your book of a story. As for the first part, do you really not know what "bad practice" means? It means you can use it, but you'd probably be cutting yourself shorter than actually learning it yourself. Also, what? C++ is not OO. You can use completely valid code, whether that be objects, structures, the main function isn't even in an object. JAVA is OO. As a professional programmer in both, Java AND C++, they're nearly identical in logic and all functions from java can be made the exact same to C++. As someone who learns better reading ACTUAL code rather than "boring stuff here. This part won't help you but we'll include it. More hiring stuff you probably won't understand", I believe others learn better testing examples and runable code rather than pseudo code you'll never learn. Hell, even my java and C++ books have actual code in them to read. The only reason in my mind that you dislike, and feel the need to make me "feel threatened" of you is because I used to (yes, used to) hack on Graal. How about minding your own business and taking that **** talker you call a mouth somewhere else. You're not wanted, nor needed, here and should dilly along to your pathetic life. |
11-26-2014
|
25 | |
:
Join Date: Jul 2012
Location: Minnesota
Posts: 818
|
Sorry if I missed some of the comments said up top. Hard to find things in blocks of text. @Tricxta I'm having some trouble comprehending so bare with me. Are you saying to keep written code organized so you can go back and find things to add or fix? Like adding comments and such with //? Also I went back into the calculator and I wanted to try focus on how functions use parameters. It keeps printing 1 for the answer for some reason. PHP Code:
I see them both used for the same purpose I think. When and why should I use one over the other? |
|
11-26-2014
|
26 | |
The muffin man
Join Date: Sep 2011
Location: Burger Refuge
Posts: 2,262
|
It all depends on the problem as to which you choose. For your application, it's preferable you stick with endl. As a general note, try keep away from inserting random symbols and numbers into your code and instead assign them to a meaningful constant's name that you'd use instead, this will be helpful after reading your code when you forget it. For most of your programming questions, chances are someone has asked the same thing in the past and stackoverflow is great for that sort of thing As for your code, you're not passing a parameter at all to your addition function. Try out PHP Code:
|
|
11-27-2014
|
27 |
Software Engineer
Join Date: Sep 2011
Location: Gold Coast, Australia
Posts: 787
|
"using" an entire namespace is horrible practice. It is preferred to use only the members of the namespace you need, such as: PHP Code:
Also, you don't really need an addition function at all. here's how i'd write it: PHP Code:
Writing a function to do basic arithmetic which is supported by the language natively is overkill. If you need any c++ help at all, feel free to add me on skype: allofthegoodnamesaretaken101 |
11-27-2014
|
29 |
Software Engineer
Join Date: Sep 2011
Location: Gold Coast, Australia
Posts: 787
|
No it's not. Please don't say things when you have absolutely no idea what you're talking about. GS2 is nothing like Java or C++. GS2 is most similar to JavaScript, which contrary to what the name suggests, is completely unrelated to Java. C++ is the lowest level of the the languages (Closest to machine code) because it forces you to manage your own memory. It has the concept of pointers, while Java & Javascript do not, using references instead. C++ is static typed & follows C-Style syntax. Java is a spiritual successor to C++ in that it follows the object oriented paradigm. It is Static typed & follows C-Style syntax. JavaScript is the highest level language of the three, as the name suggests it is a scripting language (not a programming language) and is therefore interpreted by another application. (Oftentimes a browser written in c++). Javascript is dynamic typed, and while being based on C-Style syntax, differs slightly in some areas. GS2 is barely an OOP language, it is more event driven in nature. (for example, the function onCreated() is called every time the script is initialized. GS2 has dynamic types, and a syntax nearly identical to Javascript. |
11-27-2014
|
30 | |
Graalaholic
Join Date: Apr 2012
Location: Canada
Posts: 253
|
GraalOnline runs on C++... |
|