Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Daremyth
Jan 6, 2003

That darn cup...
Jesus christ, it's an interview problem.

Most interview problems you do will be written on a whiteboard. As an interviewer, when we ask those kinds of questions, we're not focusing on code clarity, test-driven design, extensive comments, beautiful indentation or anything else. When I ask interview questions like the game of life, I'm basically looking for one thing: can this person take a real-world problem, described in English, and come up with an algorithmic solution to it. If it's a particularly hard problem towards the end of the interview, I don't even care if you write code. Explaining your algorithm and jotting down some pseudo-code is fine if we're under time pressure. I just want you to express to me that you can solve problems. Syntax is secondary.

how!!, I love that you have a beautiful and thorough process for writing your code, that's awesome. However, I have 45 minutes to spend with you during my interview. If you can't convince me that you can solve a problem in 45 minutes, we've got a stack of resumes about a yard high and I'll move on to the next one without a second thought. Interviews are about getting poo poo done.

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

pigdog posted:

What may be impressive for a smarty forums reader looking for a hip and elegant brain tease may not be as impressive for someone looking to recruit a professional programmer. Just sayin.

edit: Try showing someone that code, just the code, without showing the thread and/or the context, and time how long does it take for them to say "oh, this implements game of life with inputs and outputs like this".

It's a good thing I don't look for jobs here, or apply for jobs with my posting as an attachment.

Zombywuf posted:

code:
pep8 --repeat tef.py 
tef.py:2:19: E401 multiple imports on one line
tef.py:8:12: E225 missing whitespace around operator
tef.py:15:31: E225 missing whitespace around operator
tef.py:16:29: E231 missing whitespace after ','
tef.py:16:34: E225 missing whitespace around operator
tef.py:17:35: E225 missing whitespace around operator
tef.py:19:28: E225 missing whitespace around operator
tef.py:21:27: E225 missing whitespace around operator
sigh

yep that looks about right for my code.

return0
Apr 11, 2007

tef posted:

c.f Peter Norvig on sudoku vs TDD blogger.

I hate that I've never seen this before. Amazing.

Daremyth
Jan 6, 2003

That darn cup...

I just made the connection that it's the same person from both threads. Makes a lot more sense now.

biochemist
Jun 2, 2005

Who says we don't have backbone?
This has been a really interesting discussion to read through- I'm a (the) web dev at a small marketing firm, and I always have to find the line to balance between writing good code and getting it done. I guess it was stupid of me to think that no one else ever had that problem, but it's relieving to see this play out.

I'm self-taught, so I'm concerned with putting out good code so that I can build a portfolio- but like it's been stated, there's rarely a day where I can sit down for more than 45 minutes at a time without doing some stupid little task that no one else seems bothered to learn.

I love my job though, any job where the only gripe is the equivalent of a couple of eye rolls is all right by me.

Zombywuf
Mar 29, 2008

biochemist posted:

This has been a really interesting discussion to read through- I'm a (the) web dev at a small marketing firm, and I always have to find the line to balance between writing good code and getting it done.

The balance isn't as hard as it's often made out to be. The trick is realising that "writing good code" doesn't mean "adding lots of classes."

Consider the following (taken from a real world example):
code:
class StatusA:
  def __le__(self, other):
    if isinstance(other, StatusB):
      return False
    elif isinstance(other, StatusA):
      return True

class StatusB:
  def __le__(self, other):
    if isinstance(other, StatusB):
      return False
    elif isinstance(other, StatusA):
      return True
Some would argue that the above is a better way of having an ordered list of statuses than this:
code:
StatusA = 1
StatusB = 2
If you meet those people, kill them.

Often the best code is clear, readable and really really easy to write.

Null Pointer
May 20, 2004

Oh no!

Daremyth posted:

Jesus christ, it's an interview problem.

Most interview problems you do will be written on a whiteboard.
This isn't even a whiteboard problem. This is a first round weed-out problem. It's fizzbuzz. It's two-dimensional and it uses scanf, but it's still fizzbuzz. It's so stupid simple that you can't even have a good discussion about it (cf. the last few pages, where the only real discussion is about how!!! being one minor head injury away from working the problem with UML).

An hour is generous for this problem, but it's not just about the time. We use architecture to cope with complexity. If you give me a (non-working) solution that leans on some high-level design work, I'm going to assume that you just aren't smart enough to be able to keep a 30-line C function in your head. And I'm probably right, too.

how!! posted:

The code I was trying to write was going to have obviously no bugs. A lot of the code in my github has obviously no bugs, and that code I'm proud of and will send to employers when they ask for a code sample. That kind code is very possible to write, and very fun to write, but also takes much more time.
Are you doing formal verification? If not, no, it's not obvious at all that the code you're writing has no bugs. (Edit: Just in case you didn't get what tef posted.)

Null Pointer fucked around with this message at 00:56 on Jul 11, 2012

Safe and Secure!
Jun 14, 2008

OFFICIAL SA THREAD RUINER
SPRING 2013
Today I finally got to work with the testing scripts at my internship. Found a quadruple-level for-loop.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Safe and Secure! posted:

Today I finally got to work with the testing scripts at my internship. Found a quadruple-level for-loop.
The worst I've ever seen was mobius style goto label - imagine a while loop that jumps ahead to a goto statement while reading from a buffer via pointer arithmetic, and a while loop doing pointer arithmetic placed after that label that conditionally jumps back to that goto statement before it.

Imagine that code does something life-critical. Imagine someone opened a crash bug against it. Imagine the dude who wrote it's been gone for years.

Ensign Expendable
Nov 11, 2008

Lager beer is proof that god loves us
Pillbug
The only way I would ever write that is if "life critical" meant "you have 15 minutes to fix this or we're all going to die".

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Ensign Expendable posted:

The only way I would ever write that is if "life critical" meant "you have 15 minutes to fix this or we're all going to die".

Or it operates an X-Ray machine.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

MEAT TREAT posted:

Or it operates an X-Ray machine.
Medical device software is a great way to go gray really fast. Say you're a principal engineer for software that operates a cardiac assist device.... and it leaks memory.

Tres Burritos
Sep 3, 2009

hieronymus posted:

Medical device software is a great way to go gray really fast. Say you're a principal engineer for software that operates a cardiac assist device.... and it leaks memory.

I've always sort of been interested in embedded stuff and though this might be a great field to go into. Does anyone have any experience in the medical device industry? Is super high amounts of stress actually a common thing?

Zhentar
Sep 28, 2003

Brilliant Master Genius
I don't have any experience in it, but I wouldn't expect much stress in it. Your burden of responsibility will be shared with (and documented as such) dozens of people managing testing and approval.

csammis
Aug 26, 2003

Mental Institution
I used to work for a large company that made medical software - not the hardware, just the software - but since it was used to aid in diagnoses it was FDA regulated. There was plenty of bureaucracy, literal paperwork, and zero chance to make changes just to improve things. It wasn't stressful in terms of deadlines but it was stressful because you had to make goddamned sure each piece of code you wrote was reviewed six ways and back before it could proceed in the build pipelines. I'd think device manufacturers would have it even worse since you can't just issue updates.

KidDynamite
Feb 11, 2005

So I'm in school at Rutgers just finished Computers and Programming 101. I'm taking 102 in the fall, and then Computer Orginization and Data Structures & Algorithm Design. I'm doing Udacity(currently doing their 101) to supplement my learning and trying my hand at Project Euler(currently stuck on #3). Will this be enough to start applying for internships for next summer?

I don't really feel comfortable enough to start contributing to open source on github yet. Though I do have one where I have uploaded my Euler attempts.

Sab669
Sep 24, 2009

KidDynamite posted:

Will this be enough to start applying for internships for next summer?

I don't really feel comfortable enough to start contributing to open source on github yet. Though I do have one where I have uploaded my Euler attempts.

Well to be honest, that's a really difficult question to gauge. I would say gently caress it, apply for internships regardless.

Best case scenario:
You know your poo poo, you get an internship and learn a lot and maybe land a job
Worst case scenario:
You don't know your stuff, feel like a heel for wasting this guys time but gently caress him, you got interview experience under your belt now.



So I posted in here two days ago I think it was saying how I emailed my boss at my internship basically asking if I'd have a job here when I graduate in September or not. He told me I would, and that we could discuss it more this week.

I assume that will be tomorrow. What kind of questions should I ask? Unfortunately for me, I don't come from a well educated (or educated at all, really) background. Neither of my parents really had "full time / benefits" job with any real retirement plans or anything like that so they can't help me out much. It just occurred to me that I really don't know the first thing about any of this kind of thing.

ccrazy88
Feb 8, 2009

Sab669 posted:

Well to be honest, that's a really difficult question to gauge. I would say gently caress it, apply for internships regardless.

Best case scenario:
You know your poo poo, you get an internship and learn a lot and maybe land a job
Worst case scenario:
You don't know your stuff, feel like a heel for wasting this guys time but gently caress him, you got interview experience under your belt now.



So I posted in here two days ago I think it was saying how I emailed my boss at my internship basically asking if I'd have a job here when I graduate in September or not. He told me I would, and that we could discuss it more this week.

I assume that will be tomorrow. What kind of questions should I ask? Unfortunately for me, I don't come from a well educated (or educated at all, really) background. Neither of my parents really had "full time / benefits" job with any real retirement plans or anything like that so they can't help me out much. It just occurred to me that I really don't know the first thing about any of this kind of thing.
For benefits, you will want to find out:
1) What % of health/dental/vision insurance is covered for you/spouse/children
2) How good your health/dental/vision insurance is
3) 401k company contribution, if any, and how long you have to stay there to keep it
4) How easy it is to take vacation (don't ask your boss this), how many days and whether or not you lose them if you don't use them within 1 year -- also, possibly, if you get paid for unused ones if/once you leave (which will likely depend upon RI state law)
5) Sick day policy
6) Relocation policy, if required/desired
7) Signing bonus and terms of signing bonus (i.e. have to give it back if you don't stay a year)

Everything is negotiable, usually. If you think you got lowballed salary-wise and your boss is not budging, try getting more non-monetary benefits or a larger signing/1-year bonus.

Sab669
Sep 24, 2009

Are signing bonuses a common thing in IT / the workplace in general? To me it always seemed like a thing only for more experienced / high up positions. It's a pretty small shop, so I'd be extremely surprised if that was a thing here.

Safe and Secure!
Jun 14, 2008

OFFICIAL SA THREAD RUINER
SPRING 2013
Why aren't you applying to other places?

Sab669
Sep 24, 2009

I don't really have an answer to that. I guess mostly a lot of doubt in my ability as a programmer so I've kind of felt, 'Hey I got some where that will take me. May as well stop looking.'

ccrazy88
Feb 8, 2009

Sab669 posted:

I don't really have an answer to that. I guess mostly a lot of doubt in my ability as a programmer so I've kind of felt, 'Hey I got some where that will take me. May as well stop looking.'
As a response to your signing bonus question, I don't really know. All I can say is I am 1 for 1, but I don't work for a software company.

As for your self-doubt, if you push yourself to apply to places even though you already have a job lined up if you want it, you will make yourself a better programmer and be much more confident if and when you have to interview for your second job.

There are a bunch of companies out there that encourage applicants to solve some problem to apply (i.e. Facebook, Quora, Rapleaf, Thumbtack, lots of SF/SV startups, stuff at InterviewStreet.com). If you get interviews, you'll get a bunch of practice answering relatively difficult questions, and if you don't, you'll know that you need to improve your programming skills under pressure if you want a more lucrative/exciting/etc. job. If you don't aspire to such things once you realize it will take a lot of work to achieve them, that is perfectly fine, but it seems a little premature to do so right now because you don't yet know where you stand.

ccrazy88 fucked around with this message at 19:20 on Jul 12, 2012

feedmegin
Jul 30, 2008

Sab669 posted:

Are signing bonuses a common thing in IT / the workplace in general? To me it always seemed like a thing only for more experienced / high up positions. It's a pretty small shop, so I'd be extremely surprised if that was a thing here.

I had a relocation bonus, pay-backable if I left before a year, once. That place was a fairly horrible IT/management consultancy that had people work 60 hour weeks, that I left 366 days after joining. Otherwise it's never come up in the 7 jobs I've had in the last 15 years or so.

buttcoin smuggler
Jun 25, 2011

KidDynamite posted:

So I'm in school at Rutgers just finished Computers and Programming 101. I'm taking 102 in the fall, and then Computer Orginization and Data Structures & Algorithm Design. I'm doing Udacity(currently doing their 101) to supplement my learning and trying my hand at Project Euler(currently stuck on #3). Will this be enough to start applying for internships for next summer?

I don't really feel comfortable enough to start contributing to open source on github yet. Though I do have one where I have uploaded my Euler attempts.

Doing problem 3 in the obvious way gets me the answer in under a second. I'm not trying to be mean, but I really think you should work on your programming (or math?) skills before thinking about applying to internships. Problem 3 is not a hard problem. I literally started learning to program 2 days ago and I got it in under 5 minutes, and most of that time was spent looking up syntax.

Tenacious J
Nov 20, 2002

I'm a newbie who needs some advice about careers in the software field.

I have no background in coding except for CS 101 in college. I loved it, and have a passion for programming despite my lack of experience. I'm currently working in the psychology field, have a bachelor of arts degree, and perhaps want to move into software development. Looking at my options, going back to university for a second degree might be the way to go, but I'm hoping there are other options. I hear that a second bachelor's degree is usually a waste of time and money.

My local technical institute offers a "digital media and IT" program which is the closest thing to straight programming they have. There are also online options like Athabasca University which would be nice since I could work. Finally, there's a university in another province that offers a 20-week program to springboard into a masters of CS. Does any of this seem alright? I'm a fast learner and with the know-how I believe I could create nice programs. I wouldn't be happy with basic programming grunt work the rest of my life and would eventually like to work on or produce large, important software or games

Is there any hope of self-teaching to make a career in software dev?

Sab669
Sep 24, 2009

Judging by your use of 'province' I'm going to take a shot in the dark and guess you're Canadian or otherwise non-US citizen? I don't know of outside the US, but I've seen plenty of job postings that say "Bachelors or equivalent experience" so if you can self-teach yourself well enough and get a nice portfolio I don't see why you would be considered unemployable.

'Digital Media and IT' unless they explicitly state there are programming courses sounds much more like a design degree, focusing on perhaps web design / graphics or other multi media stuff.... My roommate is doing that and they don't teach her Javascript, PHP, nothing. The closest she got to code was HTML.

Zhentar
Sep 28, 2003

Brilliant Master Genius
You can get development jobs without a CS degree, it just means you'll always have to work harder to prove that you do know how to program. A "local technical institute" program is not likely to get you a whole lot of mileage there either. A CS Masters degree will work just fine. But actually knowing how to program is more important.

KidDynamite
Feb 11, 2005

HineyBorelTheorem posted:

Doing problem 3 in the obvious way gets me the answer in under a second. I'm not trying to be mean, but I really think you should work on your programming (or math?) skills before thinking about applying to internships. Problem 3 is not a hard problem. I literally started learning to program 2 days ago and I got it in under 5 minutes, and most of that time was spent looking up syntax.

I got something quickly too I just can't get my implementation to run in under a minute.

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
14 months ago I got a helpdesk job, dicked around with CRT and shell scripts until the devs took notice and I was offered an entry level dev job 2 months ago. On 7am Monday, for the first time ever, a little piece of code with my name all over it will be pushed to servers on over 9,000 of our customer's locations. I've gotten tons of guidance and education by lurking CoC and this thread, and wanted to give a little credit. :)

Too bad you can't break a champagne bottle on a perl script.

buttcoin smuggler
Jun 25, 2011

KidDynamite posted:

I got something quickly too I just can't get my implementation to run in under a minute.

If you're trying to factor a number n, you only need to test factors up to sqrt(n). You can find the rest based on those. You can also just test the odds on this one.

If those don't help, post the code. My implementation in Haskell takes less than a second, so there's probably something really inefficient and easy to fix.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Jonny 290 posted:

Too bad you can't break a champagne bottle on a perl script.

Put the script on an el cheapo flash drive and open a beer with it imo :)

KidDynamite
Feb 11, 2005

HineyBorelTheorem posted:

If you're trying to factor a number n, you only need to test factors up to sqrt(n). You can find the rest based on those. You can also just test the odds on this one.

If those don't help, post the code. My implementation in Haskell takes less than a second, so there's probably something really inefficient and easy to fix.

This is what I did. I made a class.
code:
public class PrimeNumber{
    public long PrimeorNot(long num){
        for(long i=2; i<num; i++){
            if(num%i==0){
                return 1;
            }
        }
        return 0;
    }
}
and then this was my main code

code:
public class ProjectEuler003{
    public static void main (String[] args){
        final long x=600851475143l;
        for( long z=2; z<x; z++){
            PrimeNumber p = new PrimeNumber();
            if(p.PrimeorNot(z)==0){
                if(x%z==0){
                    System.out.println(z+" is prime factor");
                }
            }
        }
    }
}
It hangs up after it gives the final prime factor for some reason.

Edit: even replacing
code:
 for( long z=2; z<x; z++)
With
code:
 for( long z=2; z<Math.sqrt(x); z++)

it still hangs up.

KidDynamite fucked around with this message at 01:46 on Jul 13, 2012

buttcoin smuggler
Jun 25, 2011
The reason it hangs is that your for-loop goes through 600851475141 iterations.

Note that the factors of a number N are symmetrical about the square root of that number, in the sense that if K is a factor less than the square root, then N/K is a factor greater than the square root (do you see why?). One way to do it is to find all of the factors less than sqrt(600851475143), find the corresponding factor greater than the square root, and then check to see which of the factors are prime.

This way is approximately 800,000 times more efficient (why?).

EDIT: Also I think it would be more efficient to see if the number divides 600851475143 first and then see if it is prime, instead of the other way around, as you have it. Fewer divisions that way.

Also, what the poster below said.

buttcoin smuggler fucked around with this message at 01:55 on Jul 13, 2012

csammis
Aug 26, 2003

Mental Institution
In addition to the math related changes, you're also creating 600851475141 PrimeNumber objects. Why did you choose to make the PrimeNumber calculation a class?

buttcoin smuggler
Jun 25, 2011
Yeah, sorry I missed that (I don't know anything about object oriented languages). Why can't you just write a method or function or whatever you call it instead of creating hundreds of thousands of objects?

buttcoin smuggler fucked around with this message at 02:03 on Jul 13, 2012

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

HineyBorelTheorem posted:

Yeah, sorry I missed that (I don't know anything about object oriented languages). Why can't you just write a method or function or whatever you call it instead of creating hundreds of thousands of objects?

You can? Or you could make a static class with a static method to test primeness.

You have to create objects because it's an object-oriented language. You decompose your problems into small classes that are responsible for solving one aspect of your problem. For this particular problem, one class is more than sufficient.

KidDynamite
Feb 11, 2005

csammis posted:

In addition to the math related changes, you're also creating 600851475141 PrimeNumber objects. Why did you choose to make the PrimeNumber calculation a class?

I think since I just finished that programming class that's the last thing I had in my mind. Also afterwords I couldn't figure out how to get my prime number checker working within the code regularly. I'm so bad at coding :smith:

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

KidDynamite posted:

This is what I did. I made a class.

Hey man if you want reference material for Project Euler I have a git repository with a few solutions,
https://github.com/ebcomalex/project-euler

Thom Yorke raps
Nov 2, 2004


how!! posted:

:words:
edit: I admit I have the biggest ego in the world, which is why I make posts like this, hoping someday someone will say whatever they need to say to me that will convince me to not be so egotistical.

At my current job, I had to write and release publicly an Android library five weeks after starting, as the sole employee on the project. If I worked at your pace, it would of had one feature.
Speed matters. So does maintainability, but just remember: YAGNI. Build a bunch of unit tests (do TDD), make them pass, and when you need to refactor just do it. Make it as simple as possible.

Adbot
ADBOT LOVES YOU

Null Pointer
May 20, 2004

Oh no!

HineyBorelTheorem posted:

The reason it hangs is that your for-loop goes through 600851475141 iterations.
You're about 12 orders of magnitude off.

KidDynamite posted:

I think since I just finished that programming class that's the last thing I had in my mind. Also afterwords I couldn't figure out how to get my prime number checker working within the code regularly. I'm so bad at coding :smith:

Hints: Do you even need to test if a factor is prime? Is the least factor always prime? What do you have left if you divide a factor out of a number?

Spoiler: http://pastebin.com/fvifHVjL

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply