The Big Programming Thread - Page 772
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
Hhanh00
34 Posts
| ||
RoomOfMush
1296 Posts
What we like to do in exams is give students unfinished code and a description of what the code is supposed to do and they have to finish the code or fix bugs if there are any. (We tell them beforehand if there are bugs or not) They dont have to give us a perfect solution as long as it does what it is supposed to, but the space we give them on the sheets is very limited. We dont grade silly syntactical errors like missing semicolons or misspelled variable names unless they overdo it like not using ANY semicolons and stuff like that. @JavaScript: I sure am glad I never wanted to get involved with that. I saw it as the mess it was the first time I saw it in WebDev classes. There are a lot of job opportunities that rely on web-dev though. | ||
tofucake
Hyrule18913 Posts
On October 04 2016 19:24 Manit0u wrote: Let me also share something that really cracked me up: https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f There's a JS one too https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f#.1vn12jgr5 | ||
Deleted User 101379
4849 Posts
On October 04 2016 22:12 tofucake wrote: There's a JS one too https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f#.1vn12jgr5 That's pretty much why I decided to move back to AngularJS 1, which is actually easy to use and doesn't require a billion extra things. Sure, it's a pre-2016 library, but I actually don't have the patience for all that nonsense. JavaScript is a nice language, especially outside the bad browser implementations, but the whole environment around it is a mess and library developers have completely lost track of what web developers actually need. Then again, that seems to be a trend in frameworks and libraries in all programming languages these days.... or I'm just getting too old for this. | ||
Hhanh00
34 Posts
On October 04 2016 22:12 tofucake wrote: There's a JS one too https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f#.1vn12jgr5 The scary part is that it's not even the full picture. He didn't mention anything about node js and isomorphic webapps for example. haha | ||
spinesheath
Germany8679 Posts
On October 04 2016 19:33 Hhanh00 wrote: Too often you see developers who jump to coding before they have a solid design or any idea of what they need to do. Even in interviews they try to write code before having an algorithm. Sure, there are things that are better done on the computer but to get an idea of how a person's mind work, I think it's good to use a white board. Besides, relying on debuggers is a bad habit because nowadays many bugs are very hard to reproduce. Why would bugs be harder to reproduce nowadays than before? Also jumping straight to code isn't exactly a terrible thing if you are actually refactoring towards good design (and not just cleaning up small stuff) frequently and consequently. | ||
BluzMan
Russian Federation4235 Posts
On October 05 2016 02:29 spinesheath wrote: Why would bugs be harder to reproduce nowadays than before? Also jumping straight to code isn't exactly a terrible thing if you are actually refactoring towards good design (and not just cleaning up small stuff) frequently and consequently. Well, nowadays even mobile phones are quad-core, so much of production code is multithreaded. Debugging anything multithreaded is damn pain. You might not even have directly visible threads in your environment or even use a data-race-free language, but every now and then you're pretty much guaranteed to run into some case when multiple processors execute some code at the same time and the order of them producing results matters. | ||
spinesheath
Germany8679 Posts
On October 05 2016 03:34 BluzMan wrote: Well, nowadays even mobile phones are quad-core, so much of production code is multithreaded. Debugging anything multithreaded is damn pain. You might not even have directly visible threads in your environment or even use a data-race-free language, but every now and then you're pretty much guaranteed to run into some case when multiple processors execute some code at the same time and the order of them producing results matters. And how is that different from various functions reading from and writing to global state in undocumented side effects? Bad code has always been and will always be hard to debug. | ||
BluzMan
Russian Federation4235 Posts
On October 05 2016 04:28 spinesheath wrote: And how is that different from various functions reading from and writing to global state in undocumented side effects? Bad code has always been and will always be hard to debug. That was the answer to why errors might be hard to reproduce. Bad code doesn't (usually) have stochastic nature, threading errors do. You might do "all the same things" and never reproduce the bug again. | ||
Hhanh00
34 Posts
On October 05 2016 04:28 spinesheath wrote: And how is that different from various functions reading from and writing to global state in undocumented side effects? Bad code has always been and will always be hard to debug. I said that bugs are harder to reproduce because we have more source of random bugs. The memory corruption issues you mentioned didn't go away and now we have multi-threading problems too since multi-core CPUs are common. In a sense it is like micro vs macro. You don't need a computer to see if a guy is good at design. Once you have the data structures / model and the main work flow, implementation is not much of a deal. Though, if you are hiring an entry-level developer whose job is only to code, you may have different priorities. | ||
Deleted User 3420
24492 Posts
They want me to implement one of my ActionListeners with an inner class, which I do. And in the constructor I add the listener to my button. They also want me to implement one of my ActionListeners as an anonymous class. I am not sure how I go about doing this. Would I put my anonymous class inside my constructor.. like this? member.addActionListener(new ActionListener() { //ActionListener methods/code goes here }; ); | ||
Blitzkrieg0
United States13132 Posts
| ||
Deleted User 3420
24492 Posts
new ActionListener() { etc... } being the anonymous class? | ||
OrangeGarage
Korea (South)319 Posts
I'm not talking about the .equals method, which only seems to return a boolean value, but a method that will directly transfer/copy String 1 to String 2! | ||
Deleted User 3420
24492 Posts
On October 05 2016 10:30 RCCar wrote: Hihi~ I was just wondering if there was anyway to set 1 string equal to another in java! I'm not talking about the .equals method, which only seems to return a boolean value, but a method that will directly transfer/copy String 1 to String 2! Are you asking about copying the reference, or about copying the value? Like, if your string you want to copy says "hello", do you want 2 different variables that point to this "hello", or do you want 2 different variables that point to 2 different "hello"s ? If the answer is that you don't care and you just want stringOne to say the same thing as stringTwo, then just say stringOne = stringTwo; I guess Strings are immutable in java so copying the reference is irrelevant anyways. | ||
Hanh
146 Posts
On October 05 2016 10:14 travis wrote: I *think* I understand your description of it. But I still need to know, is my use of it correct in this context? new ActionListener() { etc... } being the anonymous class? That's correct. Blitzkrieg0, what you described isn't an anonymous class in Java. It looks more like what C has but in your example the anonymous class has a name so I'm not sure what you mean by this. | ||
Blitzkrieg0
United States13132 Posts
On October 05 2016 10:35 Hanh wrote: That's correct. Blitzkrieg0, what you described isn't an anonymous class in Java. It looks more like what C has but in your example the anonymous class has a name so I'm not sure what you mean by this. Apparently I have no idea what I'm talking about, but after reading up on it I have no idea why you'd want to do functional programming in Java. | ||
Wrath
3174 Posts
On October 04 2016 19:24 Manit0u wrote: Let me also share something that really cracked me up: https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f That was interesting read and described my suffering to learn front-end development :D This paragraph caught my interest: No one does at the beginning. Look, you just need to know that functional programming is better than OOP and that’s what we should be using in 2016 Why? I don't know what FP is, I'll do some research on it but I never thought that OOP would become out dated one day. Is it really on a decline? | ||
Djagulingu
Germany3605 Posts
On October 05 2016 13:50 Wrath wrote: That was interesting read and described my suffering to learn front-end development :D This paragraph caught my interest: Why? I don't know what FP is, I'll do some research on it but I never thought that OOP would become out dated one day. Is it really on a decline? OOP can get really shitty really fast with all those objects rollin around and shit. FP, in my really subjective and personal opinion, yields a much more readable and maintainable codebase. Simple FP example: "Load the data" -> "Do this shit on the data" -> "Do that shit on the data" -> "Do the other shit on the data" -> "Store the data" As you know exactly what this shit, that shit or the other shit is, you can maintain your code a whole lot easier. | ||
Deleted User 101379
4849 Posts
On October 05 2016 13:50 Wrath wrote: That was interesting read and described my suffering to learn front-end development :D This paragraph caught my interest: Why? I don't know what FP is, I'll do some research on it but I never thought that OOP would become out dated one day. Is it really on a decline? OOP as such is not on a decline since it's still very useful. However, pretty much all OOP languages these days, from C++ to PHP to Java, include a bit of functional programming in the form of lambdas, since those make a lot of stuff easier. There won't be a switch to full functional programming because functional programming has it's own flaws, but modern programming is a mix of both. For example, taking something from my own Java refresher project: The functional way: technologies.addAll(getGameModel().getTechnologies().filterAll(t -> t.hasDependencies(faction) && !faction.hasTechnology(t))); The OOP way: for (Technology tech : getGameModel().getTechnologies()) Both do the same thing, but the functional way is more concise and actually more readable once you get used to the syntax. Of course you can hide the loops in methods to make them more readable but then that method is long and ugly compared to a single lambda. In addition to being easier to read, it can also make multithreaded programming easier, because lambdas can be executed in parallel unless you make them change outside state, which you shouldn't, and programming languages like C# and Java can almost automatically turn your code into multithreaded code. Singlethreaded: allEntities.stream().filter(e -> e.getType() == StarSystemEntityType.PLANET).collect(Collectors.toList()); Multithreaded: allEntities.stream().parallel().filter(e -> e.getType() == StarSystemEntityType.PLANET).collect(Collectors.toList()); Of course that way you don't have a lot of control over the multithreading since it happens behind the scenes, but it's an easy way to optimize the processing of large lists on multicore systems and modern compilers tend to be smarter than the programmers using them anyways. The future is neither OOP nor Functional, it's a good mix of the best parts of both. | ||
| ||