• We are delighted to introduce GiftBot 2.0, the next generation of our popular gifting feature. To celebrate, we'll be giving away some incredible prizes over the coming weeks in one big Giveaway Extravaganza!

Programming |OT| Functional, Imperative, OOP, Cargo-Cult,... all are welcome!

vypek

Member
Oct 25, 2017
4,501
So what I wound up doing last night for my Python issue was to install 2.7.16 on my PC and let it override 2.7.13 by write over the same folder I already had. Can't remove 2.7.13 from the list of programs for some reason though. Anyways, when I do "py -0" I can see that the launcher sees both the 2.7 and 3.7 versions I have installed. What is really interesting is that I don't need to specify the version when I run my scripts. The script based on 2.7 works from any folder without explicitly calling for 2.7. If I go directly into the folder where I store my scripts I can freely call for a version or the python.exe directory and then my script as an argument and it works that way. But if I am outside of that folder and I try to do that, I get an error. Not sure why though. It won't get in the way but I'll still be trying to figure out why that happens.

Make sure that in your scripts if you ever need to invoke python to run another script from within one of your scripts, you use `sys.executable` in the Popen() constructor to make sure your environment stays hermetic.
Thanks, I didn't consider this.
 

MotiD

Member
Oct 26, 2017
785
I’ve started learning about inheritance and polymorphism in Java and I’m wondering something

If I have to classes with A being the super class and B being the subclass

If I create a reference variable of A to an object of B
A test = new B()
Let’s say they both of a method public int calc(int a) that prints something but B is overloading the method with different parameters public int calc (int a, int b)
Why doesn’t the compiler realize I’m overloading the method? It first checks A anyways to see that the method exists before going to B so if the method didn’t exist in A at all it results in a compilation error or if it didn’t exist in B but existed in A it would use the parent class method

Seems weird but I’m sure there’s a logical explanation for why it works this way
 

SigmasonicX

Member
Oct 25, 2017
5,725
I’ve started learning about inheritance and polymorphism in Java and I’m wondering something

If I have to classes with A being the super class and B being the subclass

If I create a reference variable of A to an object of B
A test = new B()
Let’s say they both of a method public int calc(int a) that prints something but B is overloading the method with different parameters public int calc (int a, int b)
Why doesn’t the compiler realize I’m overloading the method? It first checks A anyways to see that the method exists before going to B so if the method didn’t exist in A at all it results in a compilation error or if it didn’t exist in B but existed in A it would use the parent class method

Seems weird but I’m sure there’s a logical explanation for why it works this way
You created test as an A, so you only have access to A methods through test. If you want to use B methods, you'll have to cast test to B.

((B) test).useBMethod()
 

Sectorseven

Member
Oct 25, 2017
3,176
Is it possible to combine two apps into one? Like if I want Hulu and Netflix in one app (I think Apple TV does something like this)?
 

Sectorseven

Member
Oct 25, 2017
3,176
No, Apple TV doesn't allow that and it's also not something that's possible.
I thought Apple TV lets you browse all the content from the different streaming services in one app. I guess that's what I'm asking. Not literally two apps in one, but like one central app where you can put all your login info and see all your content in one place.
 

Granadier

Member
Nov 4, 2018
968
Brooklyn
I thought Apple TV lets you browse all the content from the different streaming services in one app. I guess that's what I'm asking. Not literally two apps in one, but like one central app where you can put all your login info and see all your content in one place.
Apple TV has a "TV" app that they own which will show you content that's available to watch through various services, but that's not the same as "combining two apps".

You could achieve the same behavior by just aggregating all of the available content from each service and determining if something is available that way. To actually view the content itself though you will always need to go into the specific app.
 

Sectorseven

Member
Oct 25, 2017
3,176
Apple TV has a "TV" app that they own which will show you content that's available to watch through various services, but that's not the same as "combining two apps".

You could achieve the same behavior by just aggregating all of the available content from each service and determining if something is available that way. To actually view the content itself though you will always need to go into the specific app.
So it doesn't actually track account information or what you have permission to watch? Like if you select a Netflix movie on Apple TV it will launch the Netflix app, and if you aren't a Netflix subscriber, I guess it just prompts you to sign up?
 

metaprogram

Member
Oct 28, 2017
965
So it doesn't actually track account information or what you have permission to watch? Like if you select a Netflix movie on Apple TV it will launch the Netflix app, and if you aren't a Netflix subscriber, I guess it just prompts you to sign up?
Amazon Fire TV kinda does this (not sure how this is related to programming though)
 

Granadier

Member
Nov 4, 2018
968
Brooklyn
So it doesn't actually track account information or what you have permission to watch? Like if you select a Netflix movie on Apple TV it will launch the Netflix app, and if you aren't a Netflix subscriber, I guess it just prompts you to sign up?
Once the TV app has handed you off to the content provider app (Netflix, Hulu, etc.) it's up to them how they deal with you man

Amazon Fire TV kinda does this (not sure how this is related to programming though)
Yeah this. Kinda off-topic since it doesn't seem like the question is how this is achieved from a programming standpoint.
 

Sectorseven

Member
Oct 25, 2017
3,176
Once the TV app has handed you off to the content provider app (Netflix, Hulu, etc.) it's up to them how they deal with you man


Yeah this. Kinda off-topic since it doesn't seem like the question is how this is achieved from a programming standpoint.
I'm not really at the how point yet. I was just wondering if it was even feasible.
 

Dave.

Member
Oct 27, 2017
1,329
Hey guys quick question... Not necessarily exactly programming specific but anyway.

You guys have any good suggestions for video series on YouTube for UE4 or Unity tutorials?

I'm already experienced in C# and have a, very rusted, base in C++.

I know both companies have tutorials on their site but I'm looking for community made playlists.
Old post so maybe you've found lots good already, but I didn't see it answered. I've really enjoyed the youtube channel of Matthew Palaje, particularly the "Let's Create X" series. He has lots, this is the first:


They are blueprint focused in UE4 rather than C++, but I don't see that as a bad thing. They build on previous episodes so really should be watched in series.

Link to channel: https://www.youtube.com/channel/UCqPKRjVm36xmxu1OiegTWWg/videos

Have to scroll down a fair way until "2 years ago" to get to the above Genji vid and the start of the series.
 

Megasoum

Member
Oct 25, 2017
12,803
Old post so maybe you've found lots good already, but I didn't see it answered. I've really enjoyed the youtube channel of Matthew Palaje, particularly the "Let's Create X" series. He has lots, this is the first:


They are blueprint focused in UE4 rather than C++, but I don't see that as a bad thing. They build on previous episodes so really should be watched in series.

Link to channel: https://www.youtube.com/channel/UCqPKRjVm36xmxu1OiegTWWg/videos

Have to scroll down a fair way until "2 years ago" to get to the above Genji vid and the start of the series.
Cool thanks! I added his two "Let's Create" playlists to my Watch Later list
 

vypek

Member
Oct 25, 2017
4,501
I was messing around with Seleinum this weekend. Its really cool. I've barely scratched the surface and had some fun with it. Was executing javascript on pages, going through pages and clicking on stuff, sending username and password info to log into sites. Pretty fun stuff so far.
 

Dreamboum

Member
Oct 28, 2017
14,729
Howdy folks I have to make Chess in OOP Java, any good resources out there? Also I'd need to make a GUI for it and I'm kinda lost. How much time do you think it would take me ?

I'm also struggling a lot with inheritance and polymorphism, does someone have resources that really helped them wrap their head around it? Thanks
 

-COOLIO-

Member
Oct 25, 2017
1,152
i want to try my hand at creating simple music creation software. anyone have any ideas where i can start? books or online courses for digital audio programming with a focus in music creation?
 

ArnoldJRimmer

Banned
Aug 22, 2018
1,322
I have about 5 years + ( I had to check, I thought it was 4. I'm getting old!) experience with old and modern Angular guys, and I want to broaden my horizons. I've used React and Vue in the past, but mostly fixing bugs or adding small features (mostly on a node backend with some minor tweaks on the front end), so I don't have a really good feel for them and what they offer. I want to broaden my horizons and get REALLY good at at least one other front end framework. Possibly use it on an upcoming small to medium sized project at the end of this year.

What should I go for?
 

-COOLIO-

Member
Oct 25, 2017
1,152

Post Reply

Member
Aug 1, 2018
1,934
Thanks!

What would you folks say opened your eyes about OOP? I'm still struggling to grasp it fully, especially when it comes to encapsulation, overloading and polymorphism
Thinking about the concepts with real world analogies helped me when I first started learning OOP. Like, use literal objects and think about the different aspects of OOP with regards to those real world things.

Like encapsulation is keeping the inner workings of an object encapsulated inside that object (you don't want things that interact with the object to know about everything inside of the class... just what's necessary to accomplish some task). Think about a vending machine.

If you had to operate a bunch of cranks, levers and machinery yourself when you wanted to get a drink out of a vending machine, that would be a case of bad encapsulation. But in the real world, all you have to do is put money into the money slot and then select the drink you want and then the vending machine takes care of the rest. That's good encapsulation. It hides all of the stuff that's going on within that object when you ask the object to do things and it only presents its public interface, which in the case of the vending machine would be the money slot and buttons to select a drink.
 
Oct 26, 2017
706
Hey everyone, I just wanted to pop in and say you can do it. I just got offered my first software developer job today and I'm so stoked to be starting on this career path at age 33. Four years ago I started on the help desk. After a year I moved into a Business Systems Analyst position. I started getting serious about learning software development a year ago. I got friendly with the developers and studied every night. I noticed some things we could do better at work and made some applications for that. I had some terrible interviews and then a good one which led to this job. I'm so happy to have found a career I want to do for the rest of my life. If I can do it, you can too. There are so many awesome resources out there. HackerRank was great for me for interviews btw.
 

HelloMeow

Member
Oct 25, 2017
188
ideally i think i'd like to try creating a VR app for music creation, so i suppose javascript is probably no a go despite being my most familiar language.

i'm open to learning any language though. I have some familiarity with c, java, and python as well.
Your best bet would be Unity, since it has great VR support and there are several assets on the asset store that could help you, like synthesizers and sequencers.

DSP (digital signal processing) can be difficult to get into. This is the field you would need to be somewhat familiar with if you want to work with audio.
 

-COOLIO-

Member
Oct 25, 2017
1,152
Your best bet would be Unity, since it has great VR support and there are several assets on the asset store that could help you, like synthesizers and sequencers.

DSP (digital signal processing) can be difficult to get into. This is the field you would need to be somewhat familiar with if you want to work with audio.
great advice, thanks my dude.
 

MotiD

Member
Oct 26, 2017
785
My Java course will end late next month and then I'm having my exam in early July
I've done great in all the assignments so far and I'm still confident as we're hitting the tougher subjects like algorithmic complexity, polymorphism and recursion but as this latest assignment is built with questions from exams of previous years I've noticed that as the questions get harder and rely more on logic and planning an algorithm and less on your Java knowledge, I'm relying more and more on the debugger which I obviously won't have in the exam

I find it hard to execute perfectly on the first try (as I'm sure many do, but this is what the exam requires) and even when I'm solving problems I keep thinking about how much time I've spent dealing with them and this won't do for the exam

I'm not sure what I'm actually asking? I guess for the exam itself I should prepare by solving exams from earlier years and do it with a pen and paper, but does anyone have any other tips to share with me?
 

ChrisR

Member
Oct 26, 2017
2,989
Fuck internet explorer :(

Trying to decide if ES5 is easier to switch to or if I should just get Babel up and running in the old ass project I've started to update with typescript
 

Zevenberge

Member
Oct 27, 2017
351
TypeScript is worth it. If you have any project that is past the scope of half a file, then type checking will help you greatly.
(As a plus, once you've got a compilation step up and running, you can simply transpile to an ancient version of Javascript and keep legacy compatibility.)
 

ChrisR

Member
Oct 26, 2017
2,989
TypeScript is worth it. If you have any project that is past the scope of half a file, then type checking will help you greatly.
(As a plus, once you've got a compilation step up and running, you can simply transpile to an ancient version of Javascript and keep legacy compatibility.)
Ya typescript is good, just sucks I still have to support IE for this project :(
 

ArnoldJRimmer

Banned
Aug 22, 2018
1,322
I can, but then I lose a some of the stuff I had already been using... Trying to decide if I just target ES5 or go ES6+ and compile back just for IE.

Not much, but promises and find and a few other things have been great to use so far.
Ive had the pleasure of not having to worry about ie11 for far too long. ;)

I would set lib and target to es5 so that you get an error when the environment doesn't have a polyfill to support your code, then add it.

For promise es2015.promise should work.
 

Calderc

Member
Oct 25, 2017
1,689
I'm currently going through Colt Steele's Web Developer Boot Camp, does anyone have tips or pointers for the best way to approach it? Should I just run through the lectures and exercises or should I be taking detailed notes along the way?
 

milch

Member
Oct 25, 2017
532
Why does it seem like hardcore Functional Programmers consider the value of stuff like IO Monads self evident?

I have been struggling to understand the ROI of going through all the hassle of a purely functional approach for months now, but in everything I read and watch, the motivation seems to be poor considering the complexity of it all.

I is stupid :-(
 

Post Reply

Member
Aug 1, 2018
1,934
Why does it seem like hardcore Functional Programmers consider the value of stuff like IO Monads self evident?

I have been struggling to understand the ROI of going through all the hassle of a purely functional approach for months now, but in everything I read and watch, the motivation seems to be poor considering the complexity of it all.

I is stupid :-(
I've picked up F# this year and REALLY like it. I think if you're coming from an object oriented background, F# is a good way to get into functional programming because it's a hybrid language that's functional first, but it allows you to still opt into the object oriented paradigm if you absolutely have to.

If you're looking for a good book to read that explains functional programming concepts, I'd highly recommend this one:
https://www.amazon.com/gp/product/1617293997/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1

It focuses on F# though, but it helped make a lot of functional concepts clear to me.
 

MotiD

Member
Oct 26, 2017
785
Is solving the water trapping problem really hard or am I really dumb? I've been trying to solve it for a week now, with varying degrees of success but never quite solving it.
I finally saw a solution from someone in my group class and realized I've been complicating it WAY too much. like way over the top.
Thing is, now I don't want to use his algorithm and still come up with my own solution.

It's supposed to be even easier since all numbers are assumed to be greater than 0, and I'm disappointed in myself I haven't figured it yet.
 

SigmasonicX

Member
Oct 25, 2017
5,725
Is solving the water trapping problem really hard or am I really dumb? I've been trying to solve it for a week now, with varying degrees of success but never quite solving it.
I finally saw a solution from someone in my group class and realized I've been complicating it WAY too much. like way over the top.
Thing is, now I don't want to use his algorithm and still come up with my own solution.

It's supposed to be even easier since all numbers are assumed to be greater than 0, and I'm disappointed in myself I haven't figured it yet.
My recommendation would be to figure it out manually for some example problems, then try to extrapolate from them. This is one problem where drawing it could help a lot.

One key thing with algorithm problems is that you can often scale them up based on versions with only two or three entries.
 

Somnid

Member
Oct 25, 2017
2,425
Why does it seem like hardcore Functional Programmers consider the value of stuff like IO Monads self evident?

I have been struggling to understand the ROI of going through all the hassle of a purely functional approach for months now, but in everything I read and watch, the motivation seems to be poor considering the complexity of it all.

I is stupid :-(
The value is it's easier to manage the behavior of a piece of code. Basically, if values can only change in very controlled ways it allows you to more easily isolate it and understand its behavior removing many subtle classes of bugs (and then compose it in powerful ways). Monads aren't everything in FP though, Haskell is heavy with them but you can try other languages like the aforementioned F#, Ocaml (or it's more readable variant: Reason), Elm etc.
 

milch

Member
Oct 25, 2017
532
I've picked up F# this year and REALLY like it. I think if you're coming from an object oriented background, F# is a good way to get into functional programming because it's a hybrid language that's functional first, but it allows you to still opt into the object oriented paradigm if you absolutely have to.

If you're looking for a good book to read that explains functional programming concepts, I'd highly recommend this one:
https://www.amazon.com/gp/product/1617293997/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1

It focuses on F# though, but it helped make a lot of functional concepts clear to me.
The value is it's easier to manage the behavior of a piece of code. Basically, if values can only change in very controlled ways it allows you to more easily isolate it and understand its behavior removing many subtle classes of bugs (and then compose it in powerful ways). Monads aren't everything in FP though, Haskell is heavy with them but you can try other languages like the aforementioned F#, Ocaml (or it's more readable variant: Reason), Elm etc.
I have been dabbling in Scala for a while (which I like a lot). Which I guess is a weird beast because it lets you mix and match FP and OOP to the degree you're comfortable with. And a lot of it makes immediate sense.

I would say where I am struggling is when it goes from standard Scala to libraries like Cats/Scalaz etc, which introduce more Haskell-ish stuff. I would assume a lot of the same rules and laws apply in standard Scala, but it's kinda hidden from the user and sometimes a pragmatic way is chosen. All the rather abstract Category Theory related stuff is really hard for me.
 

MotiD

Member
Oct 26, 2017
785
My recommendation would be to figure it out manually for some example problems, then try to extrapolate from them. This is one problem where drawing it could help a lot.

One key thing with algorithm problems is that you can often scale them up based on versions with only two or three entries.
Yeah, that's what I've done for another question and it worked great. I've left the water trapping question for now and I'm moving on to recursion problems.
How exactly can I retain values through recursion calls without the use variables outside the scope of the recursive method? I am allowed to create additional methods to help solve the main problem
 

MotiD

Member
Oct 26, 2017
785
Generally yes, but I don't know the restrictions of your problem.
I was given the problem and the signature that only received one value.
I used overloading since I could create additional methods for help and managed to solve it that way. Thanks!

I have a general question for programmers here.. why is Java not used for game development?
 
Oct 25, 2017
2,418
I was given the problem and the signature that only received one value.
I used overloading since I could create additional methods for help and managed to solve it that way. Thanks!

I have a general question for programmers here.. why is Java not used for game development?
1) Garbage Collection means non-deterministic performance. GC is improving though.
2) Requires an additional RT. Less of a problem on PC. Bigger problem on console due to licensing.
3) C++ continues to be a fair compromise between performance and abstraction. With recent versions of the C++ standard, it’s really easy to write code with few bugs. As well, the C++ standards are not tied to a specific company.
4) it’s not useful for scripting due to a fair amount of boilerplate code being necessary in order to run. Lua, Python, JavaScript, and/or a custom scripting language are normally sufficient for that purpose.
 

Mr.Mike

Member
Oct 25, 2017
1,507
Also at this point there's a lot of momentum behind C++ in game development. Libraries are in C++, experienced developers know C++, existing code bases are in C++.
 

MotiD

Member
Oct 26, 2017
785
1) Garbage Collection means non-deterministic performance. GC is improving though.
2) Requires an additional RT. Less of a problem on PC. Bigger problem on console due to licensing.
3) C++ continues to be a fair compromise between performance and abstraction. With recent versions of the C++ standard, it’s really easy to write code with few bugs. As well, the C++ standards are not tied to a specific company.
4) it’s not useful for scripting due to a fair amount of boilerplate code being necessary in order to run. Lua, Python, JavaScript, and/or a custom scripting language are normally sufficient for that purpose.
Also at this point there's a lot of momentum behind C++ in game development. Libraries are in C++, experienced developers know C++, existing code bases are in C++.
Thanks!

Another, unrelated question - Is there some website that has well known programming questions (like the water trapping problem, which to my understanding is pretty well known) that could be asked about in exams (and probably job interviews)? I know GeeksforGeeks for example has some of these but I’m looking for a list to go over in preparation for my exam in early July
 

Reven

Member
Oct 25, 2017
672
Thanks!

Another, unrelated question - Is there some website that has well known programming questions (like the water trapping problem, which to my understanding is pretty well known) that could be asked about in exams (and probably job interviews)? I know GeeksforGeeks for example has some of these but I’m looking for a list to go over in preparation for my exam in early July
HackerRank is a pretty good website for practicing those type of technical interview questions.
 

MotiD

Member
Oct 26, 2017
785
HackerRank is a pretty good website for practicing those type of technical interview questions.
Thanks! Will have a look later

I have a question about recursion.. is my method considered recursive if it's calling itself but it does not fold back to previous calls? I have a method that's supposed to count and print something and it does so by calling itself and increasing 3 values according to some set of conditions, but the counting and printing is done with new calls (if the condition is met) and at the end I return the counter without folding back to each previous call