Live data from Hacker News

Ask HN: What is your best advice for a junior software developer?

news.ycombinator.com

381–390 of 460 posts

Re: Ask HN: What is your best advice for a junior software developer?

#381
Read books on programming and design. In today's world of stack-overflow-driven-programming, just reading docs and non-clickbait blog posts make you stand out by having more than superficial knowledge of things, but having dedicated focused knowledge expansion through reading books that aren't immediately goal-directed can accrue superpowers. It's exceedingly rare to encounter a developer who exhibits the kind of breadth of knowledge that comes from prioritizing focused reading time.

Re: Ask HN: What is your best advice for a junior software developer?

#382
post #347

Earlier quoted context omitted.

Wait wait wait. Not so fast. i'm one of those programmers who read manuals and stack traces but I have to admit that I've seen my share of both manuals as well as stack traces that didn't make much sense.

Especially when you end up in C++ template hell.

Error in boost/bind.hpp:768

Re: Ask HN: What is your best advice for a junior software developer?

#383
At some point, you will be confronted with a problem (a bug most likely), and you think it is beyond your ability to fix. Do not give up. If you can't figure out what's wrong, figure out what isn't wrong, and keep figuring out what isn't wrong. This may not feel like progress, but it is. Do not go to your dev lead and say "this one is beyond me". Say "I'm stuck, but I've tried X, Y and Z, and it's none of those things. Do you have any ideas?"

Biggest issue I find with developers right out of school, is that they often feel ok throwing a problem over the wall to a more senior dev. The truth is, all of us are confronted with problems we don't know how to solve. That is the job, but if we don't solve them, who will? You will not magically discover an ability to solve impossible problems and diagnose inscrutable bugs. But if you don't give up, and you fight your way through these problems again and again, you will develop confidence, and the instincts that allow you to do it a bit quicker next time.

On a related note, do NOT rejoice when a bug you've been struggling with suddenly goes away (another thing I've seen many times). Nasty bugs "going away" is one of the worst things that can happen. I promise you, 90% of the time it's coming back. And it's coming back at the worst possible moment, and possibly in a less friendly form.

Re: Ask HN: What is your best advice for a junior software developer?

#384
post #215

Earlier quoted context omitted.

I really like your last point "whatever the computer is telling is true from the computer point of view". In a surprising number of coding interviews that I've conducted, I've seen a candidate write an incorrect solution that generates an exception and then attempt to figure out the error almost on first principles, rather than actually reading the exception carefully and thinking about what coding errors could have…

It isn't just a huge hint, most of the time it tells you exactly what the damn issue is. This discussion is blowing my mind. I am honestly speechless. IT GIVES YOU THE LINE NUMBER AND THE FUNCTION CALL AND THE REASON! Why would you ever even attempt to debug without parsing it?

Let's try that! I was trying to do some trivial task on a .gov website, but was greeted with the following, which I'm pasting here for your convenience. Could you spot the problem? Because their customer service can't.

  ---
Error Page Exception SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.

Original Exception: Error Message: javax.servlet.ServletException: /verification.xhtml at line 66 and column 34 action="#{verificationAction.authenticateClient()}": java.lang.NullPointerException Error Code: 500 Target Servlet: Faces Servlet Error Stack: javax.el.ELException: /verification.xhtml at line 66 and column 34 action="#{verificationAction.authenticateClient()}": java.lang.NullPointerException at org.apache.myfaces.view.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:95) at javax.faces.component._MethodExpressionToMethodBinding.invoke(_MethodExpressionToMethodBinding.java:88) at org.apache.myfaces.application.ActionListenerImpl.__AW_processAction(ActionListenerImpl.java:100) at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java) at javax.faces.component.UICommand.broadcast(UICommand.java:120) at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:995) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:278) at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1307) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:733) at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:34) at org.apache.myfaces.lifecycle.LifecycleImpl.__AW_executePhase(LifecycleImpl.java:172) at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java) at org.apache.myfaces.lifecycle.LifecycleImpl.__AW_execute(LifecycleImpl.java:119) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java) at javax.faces.webapp.FacesServlet.__AW_service(FacesServlet.java:189) at javax.faces.webapp.FacesServlet.service(FacesServlet.java) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1233) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:782) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97) at com.icbc.licensing.filter.ThreadContextFilter.__AW_doFilter(ThreadContextFilter.java:92) at com.icbc.licensing.filter.ThreadContextFilter.doFilter(ThreadContextFilter.java) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) at org.apache.logging.log4j.web.Log4jServletFilter.__AW_doFilter(Log4jServletFilter.java:71) at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107) at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:949) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture$1.__AW_run(AsyncChannelFuture.java:205) at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892) Caused by: java.lang.NullPointerException at com.icbc.licensing.clio.action.VerificationAction.DbAuthInsertandCount(VerificationAction.java:118) at com.icbc.licensing.clio.action.VerificationAction.__AW_authenticateClient(VerificationAction.java:161) at com.icbc.licensing.clio.action.VerificationAction.authenticateClient(VerificationAction.java) at sun.reflect.GeneratedMethodAccessor440.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at org.apache.el.parser.AstValue.__AW_invoke(AstValue.java:268) at org.apache.el.parser.AstValue.invoke(AstValue.java) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278) at org.apache.myfaces.view.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:83) ... 46 more

Error Page Exception: Error Message: javax.servlet.ServletException: WebBeans context with scope type annotation @RequestScoped does not exist within current thread Error Code: 0 Target Servlet: Error Stack: javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @RequestScoped does not exist within current thread at org.apache.webbeans.container.BeanManagerImpl.__AW_getContext(BeanManagerImpl.java:363) at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java) at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:125) at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:96) at org.apache.webbeans.conversation.ConversationImpl_$$_javassist_0.isTransient(ConversationImpl_$$_javassist_0.java) at ...

Re: Ask HN: What is your best advice for a junior software developer?

#385

Robots are coming and so is automation. Programming opportunity will only exist in custom projects but most companies want to use COTS solutions to not beholden to contractors in the long run. This change is starting to emerge and the programming opportunities for the future will start to erode.

> most companies want to use COTS solutions This was true 20 years ago too, and yet the demand for developers is as great as ever despite more and more COTS type solutions available each day. I'm not being critical of your viewpoint, rather I'd like to understand what you believe has changed or is changing. Especially, I'm curious what role you believe robotics plays in that.

Take Python which is a language with a continually growing number of frameworks. Those frameworks take care of the majority of the grunt work that developers have traditionally had to do. The API extensibility of those frameworks it the modern COTS experience. Those APIs are all destined for the cloud and the majority of your functionality will be consumed by those cloud APIs. Your job as a programmer is merely to sow a few of those APIs together to create a shim layer of functionality with a pretty user interface.

When you get to this level of simplicity then the human factor can be quickly replaced. That's where robotics comes in.

Re: Ask HN: What is your best advice for a junior software developer?

#386
Don't be afraid to ask for help. But don't ask for help until you've made an honest ever to figure it out yourself. You learn best when someone isn't spoon-feeding you the answers.

Your project will be cancelled and your team will be reorganized. The manager you love to work for will leave.

The most important part of writing software is being able to understand it. You should be able to understand it when you're writing it, debugging it, and six months after you haven't touched it. Other people should be able to understand it. That principal informs the following rules:

1. Code for simplicity first. Do the simplest thing that can possibly work. For whatever reason in this industry, people are seduced by cleverness and complexity. You're doing a job, not trying to prove how smart you are. Clever code that is hard to understand isn't smart. The problem you're working on is probably simple. Don't try to make it fun and sexy when it isn't. Don't make something harder than it is because it would be cool to use the new shiny ____ to write it.

2. Don't repeat yourself. This is the opposite of simplicity, and your problems compound the more you do it.

3. If you have code that you are afraid to change for fear of breaking it, you've failed to make it simple and understandable. All the testing in the world won't help you if you don't understand the black box, and need to change the black box.

4. Code for readability. If you can't look at a line of code or an error message and understand what's going on, you've failed to make it simple and understandable enough. Functional code helps here; if you have to navigate between 50 different files to understand what a function is doing, something is wrong.

5. YAGNI. You will never, ever, ever need the thing you're about to spend time on and that dramatically increases the code complexity. If you ever do, it's much easier to refactor something simple than it is to work around something complex that made the wrong assumptions. Build systems in small steps.

6. Use the compiler and type system. Everything should be as strongly typed as possible to prevent future you from messing things up. The compiler is your best friend; make it work for you and write code so that when you inevitably have to change it, the type system prevents you from making a mistake.

7. Get good at debugging. This is a skill that you develop that nobody teaches you for whatever reason. When you're writing code while thinking about how it will be easily debuggable later, you're doing it right.

8. Use spaces instead of tabs. You'll make more money. Also turn on visible whitespace in whatever editor you're using and delete those silly extra spaces on the end of lines. I can see those and they're the code equivalent of walking out of the restroom with toilet paper on your shoe.

Re: Ask HN: What is your best advice for a junior software developer?

#387

Treat people with respect. Sleep well. Take care of your body and your mental health. Try to turn any feelings of inadequacy or imposter syndrome into energy to push yourself forward and increase your skills and knowledge. We've all been there... multiple times. Learn to code fearlessly: Are you being asked to run queries on a production box? Ask if you can get a user with read-only permissions. Change crusty old cod…

Love the last point. If you can internalize and truly understand this as a junior developer you will stand out among your peers, since many people can go through a whole career without ever learning to always assume the original authors of a piece of code were competent and well-intentioned.

Re: Ask HN: What is your best advice for a junior software developer?

#388

Earlier quoted context omitted.

Erh, exception types should include an inner exception parameter, for the generic one they wrap. So neither of your two examples are all that great.

Why would I wrap an exception if I don’t plan to have special handling? If it is exception that I didn’t throw because of a business reason, why not just throw the original exception?

If you don't have any special handling, then why are you catching it at all?

Re: Ask HN: What is your best advice for a junior software developer?

#389

Earlier quoted context omitted.

Why would I wrap an exception if I don’t plan to have special handling? If it is exception that I didn’t throw because of a business reason, why not just throw the original exception?

If you don't have any special handling, then why are you catching it at all?

That was the "//Do stuff" part, you may want to do some cleanup (in C# usually handled by a finally block or a "using" block), send a custom notification, logging (usually I would just let the client handle logging), etc.
Post reply on HN