The Joys Of Programming

Quick question, all (and apologies for the simplicity of it). I am a CS student and the university I am attending focuses on C (and ++ and #) and Java. I believe they teach Python in beginning programming, but I transferred here so never had to take it. I want to learn Python, but also wish to see what other languages I can pick up. Any recommendations about what other languages I should focus on? I hear Ruby is pretty big right now, but that's about all I've heard.

IlleBellus wrote:

Quick question, all (and apologies for the simplicity of it). I am a CS student and the university I am attending focuses on C (and ++ and #) and Java. I believe they teach Python in beginning programming, but I transferred here so never had to take it. I want to learn Python, but also wish to see what other languages I can pick up. Any recommendations about what other languages I should focus on? I hear Ruby is pretty big right now, but that's about all I've heard.

Once you've got a reasonable CS and programming foundation it's fairly trivial to learn a new language. Give them both a try and see which you enjoy more.

SixteenBlue wrote:
IlleBellus wrote:

Quick question, all (and apologies for the simplicity of it). I am a CS student and the university I am attending focuses on C (and ++ and #) and Java. I believe they teach Python in beginning programming, but I transferred here so never had to take it. I want to learn Python, but also wish to see what other languages I can pick up. Any recommendations about what other languages I should focus on? I hear Ruby is pretty big right now, but that's about all I've heard.

Once you've got a reasonable CS and programming foundation it's fairly trivial to learn a new language. Give them both a try and see which you enjoy more.

This. When you're a CS student, dabbling in languages should be as much a part of your daily routine as bathing. (Perhaps even more so, judging by some fellow CS students I met along the way).

I think I may dabble in prolog after haskell, because prolog looks awesome.

Languages aren't magic, they're just tools. In a way, that question is a bit like a beginning carpenter asking if he or she should learn the hammer or the saw.

It's not an either-or thing, and the more languages you're good at, the better you can think about problems you're facing. You can often use techniques you've learned in one language to do the same thing in another, as they were talking about upthread.

Simply focusing on popular languages isn't a bad approach; people who know more than you do, typically quite intelligent people, have chosen to focus on them, for whatever reason, so figuring out what the reason is can be very useful. "What is this language about?" is an important question, but "Why do people like this language?" is possibly even better.

Malor wrote:

Languages aren't magic, they're just tools. In a way, that question is a bit like a beginning carpenter asking if he or she should learn the hammer or the saw.

I'd say it's more like asking which brand of hammer to use. Unless you're asking about a functional vs imperative language and now you're talking types of tool and not just brands.

This seems like it should be simple but I'm stumped and my googleFu sucks :/ . I want to be able to supply ints w,x,y,z into the g.drawLine from the main method.

import java.awt.*; import javax.swing.*; public class example extends JPanel{ public void paintComponent(Graphics g){ g.drawLine(w,x,y,z); // <--- here } public static void main(String arg[]){ JFrame frame = new JFrame("BasicPanel"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(100,100); example panel = new example(); frame.setContentPane(panel); frame.setVisible(true); } }

I considered the simple

public void paintComponent(Graphics g, int w, int x, int y, int z){ g.drawLine(w,x,y,z); }

but that's not right. Thoughts?

krev82 wrote:

This seems like it should be simple but I'm stumped and my googleFu sucks :/ . I want to be able to supply ints w,x,y,z into the g.drawLine from the main method.

Not sure I fully understand what you want, but can't you add a setter for those values?

public class Sandbox extends JPanel { protected Point start; protected Point end; public void setLine(Point start, Point end) { this.start = start; this.end = end; } public void paintComponent(Graphics g) { g.drawLine(start.x, start.y, end.x, end.y); } /** * @param args the command line arguments */ public static void main(String[] args) { JFrame frame = new JFrame("BasicPanel"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(100, 100); Sandbox panel = new Sandbox(); panel.setLine(new Point(10, 10), new Point(90, 90)); frame.setContentPane(panel); frame.setVisible(true); } }

That's exactly what I was asking and it does indeed work. Many thanks for the clear answer as this is somehow the first time I've encountered something like this.

re: many languages
My cs department was small and in a liberal arts school, but it was good nonetheless, we had one course called Programming Languages whose purpose was to expose us to different languages.

I find the many languages stuff interesting. As a career dev I think that learning multiple languages reinforces basic CS concepts which is good, but I also think that if you don't specialize and deep dive in a particular skill set it limits your income potential. Thoughts?

Agreed. While a fellow engineer might agree with the idea of using the correct too for the job, you kinda need a specialization for your resume. It does help anyway, because knowing one or more languages doesn't really say whether you have the skills to be a valuable contributor doing whatever.

IMAGE(http://media.pcgamer.com/files/2012/04/valve-employee-big.jpg)

Increasing depth allows you to tackle more challenging problems. Being able to solve those bigger challenges usually means better pay and/or more enjoyment of your work. No question that depth is good.

Increasing breadth gives you context. As you gain exposure to topics outside your specialization, you get a better awareness of how your work fits into the bigger picture and you begin to understand the shortcomings of your ways by seeing alternate approaches (which in turn helps you improve your specialization). Breadth is also good if you haven't found a specialization or if you enjoy increased variety more than increased complexity in your work. It's best if you have an opportunity to work hands-on with something outside your specialization, but even simply reading about breadth-oriented topics is helpful [as long as you read for critical comprehension; skimming doesn't count!].

On Friday, a co-worker of mine opined that "functional languages aren't popular or successful because people think about the world in terms of objects" (paraphrased). Breadth helps you avoid fatuous statements like that.

Breadth is critical, because in a fast moving field like computing, your depth can be rendered somewhat irrelevant almost overnight.

Also, I find it's a lot easier for a programmer with solid breadth to deep dive into a new field of depth, but a programmer who has been tunnel-visioned to only his depth has a hell of a time re-building breadth.

*Legion* wrote:

Breadth is critical, because in a fast moving field like computing, your depth can be rendered somewhat irrelevant almost overnight.

Also, I find it's a lot easier for a programmer with solid breadth to deep dive into a new field of depth, but a programmer who has been tunnel-visioned to only his depth has a hell of a time re-building breadth.

This.

On the other hand, breadth is also easy to develop (when you're simply talking languages). We (an all Java shop) just hired a guy with zero Java experience because learning a new language is trivial when you've got solid foundations. He's doing great too.

On the other hand from that, it's a lot easier to switch to and be safely productive in a language like Java than C++, so context is always important.

I guess I have no real point.

RolandofGilead wrote:

re: many languages
My cs department was small and in a liberal arts school, but it was good nonetheless, we had one course called Programming Languages whose purpose was to expose us to different languages.

I took a Comparative Languages class as well.

*Legion* wrote:

Breadth is critical, because in a fast moving field like computing, your depth can be rendered somewhat irrelevant almost overnight.

Also, I find it's a lot easier for a programmer with solid breadth to deep dive into a new field of depth, but a programmer who has been tunnel-visioned to only his depth has a hell of a time re-building breadth.

I agree that breadth is critical when it comes to technologies, but not as criticial when it comes to languages. There are still very popular main stream languages (C++, Java, Perl, Python, etc...) that have been around for decades so I don't think a programing language will become "irrelevant almost overnight".

When it comes to technologies, 5 years ago Ajax was the buzzword everyone talking about. Right now the term cloud is being thrown around. Who knows what tomorrow will yield.

I've always found that the greatest benefit of learning several languages is in the exposure to different technologies and different ways of doing things you get. There's nothing really syntactically very different between C++, Java, Python, etc... but they tend to be used for very different problem domains. And it's that which gets you exposed to different technologies and different ways of thinking about and solving problems.

Ajax is still pretty important.

Seven Languages in Seven Weeks is a nice survey book. No "heavy" languages (Java, C#, C/C++) but it does a nice job of introducing each of the languages it covers: Ruby, Io, Prolog, Scala, Erlang, Clojure, Haskell.

SixteenBlue wrote:

Ajax is still pretty important.

Ajax is exceptionally important, it's just gotten a lot easier with JQuery and better server side support like the Web API and MVC stacks in .NET, etc.

Two weeks down and one assignment down. I want to say this is hard, but the programming is easy. It's the problem solving that is giving me the most issues. It seriously took me on and off (mostly off) of 3 days to figure out how to do get the amount of hours that have passed since midnight.

Spoiler:
def to_24_hour_clock(hours): return hours % 24 def get_hours(seconds): return to_24_hour_clock (seconds // 3600)

My brain is actually a bit sore from the assignment. Best analogy is that I've gone to the gym for the first time in a long time and now my brain is sore from the workout. Since work isn't challenging anymore, my brain has gotten lazy.

If you're curious, here it is (a1.py).

Problem solving is the part of the job I enjoy the most. Sometimes, it's like a natural evolution as I'm building a solution, other times, I'm glad to have learned to use the back-burner mentality of focusing on something else and letting a problem stew until it is ready (those epiphanies are great, btw).

bandit0013 wrote:
SixteenBlue wrote:

Ajax is still pretty important.

Ajax is exceptionally important, it's just gotten a lot easier with JQuery and better server side support like the Web API and MVC stacks in .NET, etc.

I wasn't saying it isn't important. Just not the buzzwords people are throwing around today. Though I kind of hate Ajax. It allowed webpages to be more responsive which means people are developing webapps when it makes more sense to make a thick app.

Edwin wrote:

Two weeks down and one assignment down. I want to say this is hard, but the programming is easy. It's the problem solving that is giving me the most issues. It seriously took me on and off (mostly off) of 3 days to figure out how to do get the amount of hours that have passed since midnight.

Spoiler:
def to_24_hour_clock(hours): return hours % 24 def get_hours(seconds): return to_24_hour_clock (seconds // 3600)

My brain is actually a bit sore from the assignment. Best analogy is that I've gone to the gym for the first time in a long time and now my brain is sore from the workout. Since work isn't challenging anymore, my brain has gotten lazy.

If you're curious, here it is (a1.py).

I'm having a lot of fun in the class. I've always been a good logic problem solver and programming just seems to click with me. All those TRS-80 computer summer camps I went to as a kid I guess!

Which class is this?

*Legion* wrote:

Breadth is critical, because in a fast moving field like computing, your depth can be rendered somewhat irrelevant almost overnight.

Also, I find it's a lot easier for a programmer with solid breadth to deep dive into a new field of depth, but a programmer who has been tunnel-visioned to only his depth has a hell of a time re-building breadth.

"Jack of all trades, master of none,
Certainly better than a master of one?"

Pretty analogous to the edX/MITx 6.00x course I'm taking. It's mostly review thus far, but I'm enjoying the details that ground my otherwise-shipshod understanding of programming.

MacBrave wrote:
*Legion* wrote:

Breadth is critical, because in a fast moving field like computing, your depth can be rendered somewhat irrelevant almost overnight.

Also, I find it's a lot easier for a programmer with solid breadth to deep dive into a new field of depth, but a programmer who has been tunnel-visioned to only his depth has a hell of a time re-building breadth.

"Jack of all trades, master of none,
Certainly better than a master of one?"

Jack of all trades usually means a person who is average in everything he does, but he can do anything. Would you rather work in code written by an average person, or a master?

To give an example. You live in a village that has a baker, a blacksmith and a jack of all trades that does both. Who would you buy your bread from? Who would you pay more?

kazar wrote:
MacBrave wrote:
*Legion* wrote:

Breadth is critical, because in a fast moving field like computing, your depth can be rendered somewhat irrelevant almost overnight.

Also, I find it's a lot easier for a programmer with solid breadth to deep dive into a new field of depth, but a programmer who has been tunnel-visioned to only his depth has a hell of a time re-building breadth.

"Jack of all trades, master of none,
Certainly better than a master of one?"

Jack of all trades usually means a person who is average in everything he does, but he can do anything. Would you rather work in code written by an average person, or a master?

To give an example. You live in a village that has a baker, a blacksmith and a jack of all trades that does both. Who would you buy your bread from? Who would you pay more?

Your analogy has a problem. Two different kinds of code still are fundamentally code. To make your analogy more accurate, compare a bread baker and a donut shop. And even then, your point has a problem. What happens when some diet guru moves into town and convinces everyone to change their eating habits and the new thing is bean-cakes?

A baker or pâtissier who, in addition to his mastery of his discipline, has studied the fundamentals of general baking and pastry prep would have a fairly easy time figuring that out and moving in to master the new food. Someone who has only made yeast bread their whole career and hasn't studied anything else is in for a harder time.

Happens to us all the time. This business re-invents itself every couple years, and if you just stick with one thing you can end up as marginalized as a buggy-whip maker if you're not very careful.

The jack-of-all-trades comparison really isn't all that accurate, either. A "t-shaped" person isn't master of no trades; he's the master of one and familiar with many. With his mastery of the one, he has experience in gaining that sort of knowledge and an understanding of what it is to master something fully. That is important. You do not want someone who just flipped his four-block horizontal instead of vertical. But having that horizontal bit is crucial too. The broad base of other familiarities give him context to gain more depth, use those depths even more effectively, and an increased ability to apply his mastery in new directions.

If you keep your eyes open, you never know when something is going to end up useful. I have a friend who became a doctor. He was a little chagrined when he got to the first parts of the surgery course and discovered the hated embroidery his mother had made him do when he was younger was similar to the stitches used, and while surgical materials and techniques are quite different, his familiarity with handling thread made it a heck of a lot easier for him to pick up the nuances and go to the head of the class. Ironically, he ended up a radiologist.