The Joys Of Programming

cartoonin wrote:

Any tips for someone completely green to programming? I just started back this week (for my second semester in Cyber Defense) and Intro to Programming and Logic is one of the courses that I am taking.

Read a lot.

cartoonin wrote:

Any tips for someone completely green to programming? I just started back this week (for my second semester in Cyber Defense) and Intro to Programming and Logic is one of the courses that I am taking.

you should assume any problem you are trying to solve has been solved before by someone else. 5 minutes reading the docs for [insert language here] standard library or 5 minutes googling will likely save you hours/days/months of work.

More often than not knowing the vocabulary needed to find a solution is more valuable than being an amazing top flight mega programmer.

(except perhaps on your course where you will asked to implement stuff from scratch for the sake of learning)

DanB wrote:
cartoonin wrote:

Any tips for someone completely green to programming? I just started back this week (for my second semester in Cyber Defense) and Intro to Programming and Logic is one of the courses that I am taking.

you should assume any problem you are trying to solve has been solved before by someone else. 5 minutes reading the docs for [insert language here] standard library or 5 minutes googling will likely save you hours/days/months of work.

1. StackOverflow

2. The best thing about programming is that it's interactive: type stuff in, run it, and the computer will tell you if it will break. It's just about the only thing on the planet where you can get that degree of instant, objective feedback. Continually running the thing you're writing will tell you a lot.

2a. It won't, however, tell you if it's right. Or if your code is the most efficient way of doing something. Or if there's an edge case that you missed. There are tools to help with that (writing tests, profiling, etc.) but it's ultimately on your head.

2b. But you can still use that instant feedback to help you explore the different possibilities.

cartoonin wrote:

Any tips for someone completely green to programming? I just started back this week (for my second semester in Cyber Defense) and Intro to Programming and Logic is one of the courses that I am taking.

Practice on problems you want to solve. I.e. you learn more writing scripts to manage your mp3 files than you do in the classroom writing "class Dog extends Mammal".

PWAlessi wrote:
cartoonin wrote:

Any tips for someone completely green to programming? I just started back this week (for my second semester in Cyber Defense) and Intro to Programming and Logic is one of the courses that I am taking.

Read a lot.

Read a lot of code especially. These days there’s an absurd amount of software with code available so you can understand how basically any kind of program works, including ones you rely on. Be brave and dive in and try to learn how things really work. You’ll learn a lot of idioms that way too.

Thank you all! I appreciate the info everyone! I will be digging in quickly, reading whatever is thrown my way.

Someone in a Cincinnati-local Slack suggested this as a good start for learning to develop an API using Python. I like Michael Kennedy’s podcast, _Talking Python_, and this seems like a good intro.

https://training.talkpython.fm/cours...

fenomas wrote:
cartoonin wrote:

Any tips for someone completely green to programming? I just started back this week (for my second semester in Cyber Defense) and Intro to Programming and Logic is one of the courses that I am taking.

Practice on problems you want to solve. I.e. you learn more writing scripts to manage your mp3 files than you do in the classroom writing "class Dog extends Mammal".

This is the best advice. As someone completely green, you have no frame of reference to understand code you're looking at, and no basis to form a judgement on whether you're looking at good code or bad code (and bear in mind that bad code examples greatly outweigh good examples when googling your way through problems).

I'm not a fan of encouraging people to read a lot of books when starting out. You have nothing in your head to attach the knowledge to, and there's a good chance you'll waste a lot of time trying to understand concepts like idempotency when you have no need to understand them yet. Best way to learn is to identify some task you'd like to solve in your daily life, and then work out how to program a solution to some part of it. Or, if you want some standard business tasks that will teach knowledge almost certain to be useful, go back several pages in this thread to when I posted some sample project ideas.

I'll also point out that there will be a point where you know the basics, but then start running into problems where you have no idea if you're doing something wrong, or if the tools/software are broken, and you don't even know how to go about figuring out how to address the issue. It's the most frustrating part of learning programming. Expect it, and push through, no matter how frustrated you get. Each time you slam your head against the wall, you'll retain a tiny bit more than you did previously, and over time you'll climb over that wall.

Absolutely! I did my first bit of successfuly programming at class last week and have another class tonight, so we'll see how it goes.

Thanks again to everyone who contributed!

I would say that learning a programming language is the easy bit.

There are a million ways to accomplish even the most trivial task. The harder thing to be able to discern is which subset are the best or most sensible ways to accomplish your task.

The Internet is full of intro level advice it's much harder to find good and practical advice on best practice (for any given technology).

But I'd say this comes back to my earlier advice. Before you write any code do your due diligence and research what others have already done before you. That can be the Internet or more senior devs who have been there before you.

You can determine the approximate age of a programmer based on if they think JSNES is a Java-based SNES emulator, or a JavaScript-based NES emulator.

Spoiler:

It's the latter. Damn millennial coders.

In this wondrous new age, just compile bsnes with Emscripten to yield jsbsnes.

Codingame added a relatively straightforward bot game based on "Ultimate Tic-Tac-Toe", a great entry point for beginners interested in AI algorithms like minimax, alpha-beta pruning, or monte carlo tree search.

https://www.codingame.com/multiplaye...

An algorithm that takes the center first, then random valid points will get you out of the bottom league. A pretty simple local board optimizer should get you out of bronze. I'm working on a solution that looks several moves ahead now to move out of silver.

@mlrawlings wrote:

It's imperative you let people know the quality of your library. To help, here are some README badges.https://t.co/hHRV00rkBfhttps://t.co/ralSIVQMHE IMAGE(https://pbs.twimg.com/media/DYdEqtKU8AAVZ-S.jpg)

— Michael Rawlings (@mlrawlings) March 17, 2018

Any R programmers here working on learning Machine Learning? Do we have any kind of Discord for this? Did I miss an announcement somewhere impossible to miss?

UMOarsman wrote:

Any R programmers here working on learning Machine Learning?

Yes and yes, although I'm doing way more python atm.

UMOarsman wrote:

Do we have any kind of Discord for this?

Not to my knowledge

UMOarsman wrote:

Did I miss an announcement somewhere impossible to miss? :-)

Nope

There are a few ways to chat with folks anymore. Curse/Twitch Chat, Discord and Slack - I believe they’re all listed in the voice comms thread.

DanB wrote:
UMOarsman wrote:

Any R programmers here working on learning Machine Learning?

Yes and yes, although I'm doing way more python atm.

Can I ask what drove you to python over R?

UMOarsman wrote:

Any R programmers here working on learning Machine Learning? Do we have any kind of Discord for this? Did I miss an announcement somewhere impossible to miss? :-)

Yep. Slowly walking through the caret package.

UMOarsman wrote:
DanB wrote:
UMOarsman wrote:

Any R programmers here working on learning Machine Learning?

Yes and yes, although I'm doing way more python atm.

Can I ask what drove you to python over R?

Well I love R but it is also a terrible language for getting things done. From a more Data Science, end-to-end data analysis perspective R is seldom suitable for all the other data handling operations that aren't the statistics-training-predicting bits. Nor is it suitable for the larger data processing software systems we work on.

Some of the issues that make R a poor choice for larger software systems arise from terrible, fundamental decisions in the language design and some issues from the scads of poor code and R tutorials out there. Almost everything out there focusses on R as little more than a tool for performing statistics operations but I feel that at a minimum everyone interested in serious R coding should read Hadley Wickham's 'Advanced R Programming' (free online iirc) and should at least read the memory management bits of 'The R Inferno' (also free online iirc).

For my own workflow I typically use python for data gathering, organisning, preprocessing, cleaning and whatnot. All the ancillary bits that aren't the modelling that take up 80-90% of the effort. It is also way easier in our field to hire strong python coders than R coders. So that reinforces that fact python is a solid choice for most of the work as its easier to hire colleagues who understand what the hell is going on.

Having got data in to a form that doesn't need lots of additional work it is really only then I'd bring it in to R to do all the math-y or stats-y stuff. And I pretty much only use ggplot2 for figure preparation these days.

Increasingly our group is moving to applications of deep learning and all the useful scripting libraries for that (pytorch, keras etc...) are implemented in python. And that kind of further relegates R to being the language for plotting or doing more the traditional/frequentist stats bits (precision, recall, ROC plots, distribution tests, etc...)

I just don't want to learn another language. My brain already hurts.

Iridium884 wrote:

I just don't want to learn another language. My brain already hurts.

I am not surprised. I'm not sure if have got anywhere with programming at all if R was my first exposure.

Do read the 2 books I mentioned. They are a much more formal take on "R as a programming language". Which should help R make more sense and be less mind bending. And thinking of it in more programming terms will set your up for learning new languages (should you ever need to).

Hey DanB,
Even though it's not really programming what are your thoughts on RapidMiner for data analysis?

lunchbox12682 wrote:

Hey DanB,
Even though it's not really programming what are your thoughts on RapidMiner for data analysis?

Don't know a huge amount about it. I've had it demo'd to me a couple of times in a previous commercial role.

As much as I know is it one of a very large class of commercial workflow management systems for data science out there. There seem to be quite a lot of these that but rapidminer appears to have a large chunk of the mindshare in the more modern of these. SAS is probably the incumbent software for stats and data mining in the commercial space but I have no idea to what extent rapidminer has taken market share.

I recall the visual programming side looked pretty neat and it has easy hooks in to other enterprise platforms like Oracle and salesforce. Like all of these things you probably get to a point where the WYSIWYG programming is limiting and you have to crack open the bonnet. I vaguely recall that it has its own underlying DSL to learn but you can also write R or python against it if you'd rather which is neat.

Its a pretty common feature of these commercial data science platforms to have their own proprietary DSL you have to learn to use them. But the nicer ones like rapidminer or azure typically give you some kind of R and/or python support.

If what you're interested in is visually programmed, data analysis, workflow management engines in general (rather than rapidminer specifically) then Apache Taverna is the only direct equivalent I can think of in the FOSS space
https://taverna.incubator.apache.org....

If you don't care about the GUI and pre-rolled maths/stats functions and want to program it all yourself consider Common Workflow Language
http://www.commonwl.org/

And I'll take some time to plug our project, Analytics Automated, which is designed to deploy data analysis workflows as RESTful services (and also takes python and R, and if someone eventually gives me the money we'll be upgrading it to support Common Workflow Language)
https://analyticsautomated.github.io/

IMAGE(https://i.imgur.com/6xAMRIE.jpg)

Hey all I've got a question that kind of gets into the weeds a bit, but hopefully someone has some ideas. We are dealing with a piece of software that has turned into spaghetti over the months, as so many do, and it's looking like a rewrite or at least a massive refactor is in order.

We've been looking at the entity-component-system pattern as a way to rewrite and keep things separate, along with making debugging and adding new features much easier. People all over seem to love this method of software design. It's completely different from what I personally have ever done, so just wrapping my head around how to write software like that has made this an interesting work week. We are using Unity for our software (it's not a game, but it does have 3D elements and things like that), and they are going to be switching their whole paradigm to ECS in upcoming versions as soon as later this year, so it would be good to get in ahead of the game (as it were).

Most coding changes will be pretty straightforward, but our biggest issue right now with figuring out how to make the conversion with our code is the GUI. We have many buttons, along with sliders and text boxes and more in our software's interface, and it seems one large issue with ECS is that there is no true simple and widely-accepted solution for handling a GUI with it. Most people seem to use an event type system to handle button presses, but others say just don't use ECS for the GUI, use it for everything else. Does anyone here have any experience with ECS at all? Any suggestions for using ECS for a GUI? Does an event system seem like the best way to do it, and how could it even be done with ECS?

I'm a big fan of ECS and have been using it lots for the past few years (to the extent of rolling my own ECS library), but I think its usefulness is pretty narrow - it's actually kind of hard to imagine a non-game use case where ECS is a good fit. As a data point, I believe some developers recommend against ECS generally, and are leery about Unity's reliance on it - IIRC Jonathan Blow argues somewhere that even for games, one should start out with mundane data structures and not adopt ECS until you're really sure why you need it.

Not trying to harsh your high or anything, just data points

That said, my approach to what (I think) you're asking is that I keep my game logic and my UI logic rigidly separated, with the former using ECS to manage its state and the latter using regular static objects, and event passing between. For example, on the game logic side of things there's an ECS component that stores hit point values, and the player entity has that component, so the player's current HP lives inside the ECS. But on the UI side, there's a UI state object with a property like "ui.state.player.currentHP". When the player takes damage, the core emits a general "entity-HP-changed" event, and a module inside the UI catches that and updates the UI state object's property. Then the module that actually draws to the screen only knows about the UI state object property, it doesn't know about game logic or the ECS.

Is that the kind of thing you're asking about? (I don't know anything about Unity, or if there are Unity-specific reasons to use ECS a particular way, etc...)

Thanks fenomas! That does help and it was indeed the kind of thing I was asking about. I had been thinking similar thoughts about it in the sense that it might be overkill or not well suited to our application, but at the same time we did start out with mundane data structures and the end result was not pretty. We're going to stick to it for now though because it will help with a lot of the problems we've been having and it will help with using the same code in other projects.

It sounds like you do your UI in the same way we have ended up deciding to do it, which is essentially an event system. We're keeping the UI and software logic as separated as possible too. That was one of the problems we had - the UI was too connected to everything else. Changing or adding things or finding bugs was turning into a huge issue because you had no idea where various things were affected or connected.

With Unity and ECS specifically, it's kind of complicated I guess. Unity is set up sort of in an ECS way already, just the way you create and use game objects and attach components to them in the editor. But it's not really enforced, and you can do anything you want with the code you write, so the System part of ECS can be a mess (which it is for us).

Malor wrote:

IMAGE(https://i.imgur.com/6xAMRIE.jpg)

Yesterday was my last day at a job that lasted three years and change, and I'm taking a week and a half off before the next gig starts. During that interval I need to get a crash course in Python — because my previous jobs have had me working in Java, Node.js, Ruby, PHP, C#, and a few other languages but never Python! This picture is how I expect to feel: everything is vaguely familiar but in a terrifyingly disoriented way.