Software Development and Programming Careers (Official Discussion Thread)

TheAnointedOne

Superstar
Joined
Jul 30, 2012
Messages
7,784
Reputation
666
Daps
30,669
200 line genetic algorithm in c++. Type in a single phrase in all lower case and it tries to guess the target phrase in multiple generations. In each generation it gets better and better:

Code:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <tuple>

#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif

namespace intelligence {

    const unsigned CHARCODE_BEGIN = 97 ;
    const unsigned CHARCODE_END = 122 ;

    class Chromosome {

        std::vector<char> _genes ;

      public :

        Chromosome(): _genes{} {}

        Chromosome( unsigned short geneSize ) {

            for( int i = 0 ; i < geneSize ; i++ )    
                _genes.push_back( CHARCODE_BEGIN + rand() % (CHARCODE_END-CHARCODE_BEGIN+1) ) ;
        }

        float calculateFitness( const std::string& target ) {

            float fitnessScore = 0.0f ;        

            for( int i = 0 ; i < _genes.size() ; i++ ) {

                if( _genes[i] == target[i] )
                    fitnessScore++ ;                
            }

            return pow( fitnessScore / target.length(), 2 ) ;
            //return fitnessScore / target.length() ;
        }

        Chromosome crossover( const Chromosome& other ) {

            Chromosome child ;
            std::vector<char> newGenes ;        
            int midPoint = rand() % other.size() ;

            for( int i = 0 ; i < this->size() ; i++ ) {
            
                if( i > midPoint )
                    newGenes.push_back( other.getGene( i ) ) ;

                else
                    newGenes.push_back( this->_genes[i] ) ;
            }

            child.setGenes( newGenes ) ;

            return child ;
        }

        void mutate( float mutationRate ) {

            std::replace_if( _genes.begin(), _genes.end(), [mutationRate]( char unused ) {
                return ( ((rand() % 100) * 0.01f) < mutationRate ) ;
            }, CHARCODE_BEGIN + rand() % (CHARCODE_END-CHARCODE_BEGIN+1) ) ;        
        }

        void setGenes( const std::vector<char> genes ) {
            _genes = genes ;
        }

        std::vector<char> getGenes() const{ return _genes ; }
        char getGene( int idx ) const{ return _genes[idx] ; }

        unsigned int size() const{ return _genes.size() ; }
    } ;

    class Population {

        std::vector<Chromosome> _population ;
        unsigned short _generation ;
        unsigned short _mutationRate ;
        std::string _target ;

      public :

        Population( unsigned short popSize, const std::string target, unsigned short mutationRate ): _target(target),
            _mutationRate(mutationRate), _generation(0) {

            for( int i = 0 ; i < popSize ; i++ )
                _population.push_back( Chromosome( target.length() ) ) ;        
        }

        void acceptReject() {

            std::vector<Chromosome> newPopulation ;
            unsigned short maxFitness = getHighestFitnessScore() ;

            for( unsigned int i = 0 ; newPopulation.size() < _population.size() ; i++ ) {        
            
                Chromosome parentA = _population[ rand() % _population.size() ] ;
                Chromosome parentB = _population[ rand() % _population.size() ] ;            
                float randomScore = 0.01f + (rand() % maxFitness) * 0.01f ;

                float parentAScore = parentA.calculateFitness( _target ) ;
                float parentBScore = parentB.calculateFitness( _target ) ;

                if( (parentAScore > randomScore) && (parentBScore > randomScore) ) {
                
                    Chromosome child = parentA.crossover( parentB ) ;
                    child.mutate( _mutationRate ) ;
                
                    newPopulation.push_back( child ) ;
                }
            }

            _population = newPopulation ;
            _generation++ ;
        }

        void run() {

            float bestScore = 0.0f ;

            std::cout << "Target: " << _target << '\n' ;

            while( bestScore < 1.0f ) {

                std::tuple<std::string, float> info ;

                info = getHighestFitness() ;
                bestScore = std::get<1>(info) ;
            
                std::cout << "Generation: " << _generation << "; Best Guess: " << std::get<0>(info) << "; Best Score: " << bestScore*100 << "%\n" ;

                acceptReject() ;
            }
        }

        unsigned getHighestFitnessScore() {

            float highest = 0.0f ;

            for( auto itr : _population ) {

                float fitnessScore = itr.calculateFitness( _target ) ;

                if( fitnessScore > highest )
                    highest = fitnessScore ;
            }

            return unsigned(highest * 100) ;
        }

        std::tuple<std::string, float> getHighestFitness() {        
        
            std::vector<char> highestString ;
            float highestScore = 0.0f ;        

            for( auto itr : _population ) {

                float fitnessScore = itr.calculateFitness( _target ) ;

                if( fitnessScore > highestScore ) {
            
                    highestScore = fitnessScore ;
                    highestString = itr.getGenes() ;
                }
            }

            std::string s( highestString.begin(), highestString.end() ) ;

            return std::make_tuple( s, highestScore ) ;
        }    

    } ;
}

void printGenes( const std::vector<char>& genes ) {
    for( auto itr: genes )
        std::cout << itr ;

    std::cout << '\n' ;
}

int main() {

    srand( time(NULL) ) ;

    std::string target ;
    std::cout << "Enter Target Phrase: " ;
    std::getline( std::cin, target ) ;

    intelligence::Population p( 1500, target, 0.05f ) ;
    p.run() ;

    return EXIT_SUCCESS ;
}

god damn
 

Obreh Winfrey

Truly Brehthtaking
Supporter
Joined
Nov 18, 2016
Messages
20,852
Reputation
25,252
Daps
131,941
Anybody bother to study up on design patterns? Have you found it necessary at your jobs?
Not really, but you should just in case. I don't do too much programming in this role, but when I do I try to use that as an opportunity to learn. I did some stuff with abstract classes and singletons the last time I wrote something. Learned about the Java Stream API and some stuff with reflections that allows the end user to specify a class with custom behaviors to be used at runtime.
 

TheAnointedOne

Superstar
Joined
Jul 30, 2012
Messages
7,784
Reputation
666
Daps
30,669
Damn is the industry impenetrable?

Even this guy is having trouble



His resume:

owasim1/My-Resume

I haven't started job hunting yet. But unlike me this guy has a bachelor's degree and some experience. And even he can't find any work.
 

Thanos

?
Joined
Nov 21, 2016
Messages
5,444
Reputation
843
Daps
17,278
Reppin
Atlanta
Damn is the industry impenetrable?

Even this guy is having trouble



His resume:

owasim1/My-Resume

I haven't started job hunting yet. But unlike me this guy has a bachelor's degree and some experience. And even he can't find any work.


He could write that project & experience section better, but this is bad time you are trying to get in.
 

Macallik86

Superstar
Supporter
Joined
Dec 4, 2016
Messages
6,506
Reputation
1,372
Daps
21,227
Damn is the industry impenetrable?

Even this guy is having trouble



His resume:

owasim1/My-Resume

I haven't started job hunting yet. But unlike me this guy has a bachelor's degree and some experience. And even he can't find any work.

It could be bad luck but also I want to point out:
  1. We are in a recession.
  2. He has three jobs on his resume and they are all less than 4 months in length. He might be better off with a website and highlighting his personal projects instead maybe?
  3. His Github is pretty dry and the projects on display didn't seem very inspiring. As someone new to the web dev side of things, I looked at 3 of his projects and they look like they were completed in less than a day collectively.
 

Obreh Winfrey

Truly Brehthtaking
Supporter
Joined
Nov 18, 2016
Messages
20,852
Reputation
25,252
Daps
131,941
Damn is the industry impenetrable?

Even this guy is having trouble



His resume:

owasim1/My-Resume

I haven't started job hunting yet. But unlike me this guy has a bachelor's degree and some experience. And even he can't find any work.

I've posted before that it took me 6 months and well over a thousand applications to land a job. I was doing at least 10 applications per day for weeks on end, with several iterations on my resume. In the end, I got hired off of a weaker revision of my resume on a role I applied to probably 4 or 5 months prior. His experience isn't all that unique, because there were people who I graduated with that took even longer.

If you're nearing graduation and only just starting to apply, or haven't even started yet, you can pick up your L now because college grad programs often start their process about 6 months to a year out from start dates. By the time you get in there, they've already selected the bulk of their candidates and you could be assed out.

The guy's resume reads as if they only have a cursory understanding on what they did, like they were more of a spectator. There's not a lot of substance on there. Bullet by bullet from the top:
  • What functionality was enhanced? Was it a new UI or did they build on an existing one?
  • How? What was the assessment criteria?
  • Did they translate from witeframe? From user stories?
  • Acceptable
  • Very generic, but acceptable
  • Good
  • Good
  • Should be rolled into the above point about Google Maps API
  • How did they test? Automated testing? Manual? Unit tests?
  • What sort of analysis? What is customer type - that doesn't hold a lot of meaning to an outsider.
  • Feels like they threw out some Python Data Science terms without really understanding what they are and how to use them
  • Probably the best piece in the whole document.
  • Decent
  • :usure: OK anything else?
  • This isn't an accomplishment, that's part and parcel of what you're supposed to do.
  • Very basic
  • I bet you can tie your shoes too :usure:
  • tenor.gif

  • Acceptable
  • OK, but how? The how is normally more important than the what.
  • Once again, how?
Resume needs work. All of those work experiences read as internship positions, so they need to explicitly state that, otherwise it looks like a poor showing. Until they land that solid first role, I'd move education to the top so that it catches attention early that they're a recent grad. And if the GPA is above 3, include it.
 

SNG

Superstar
Joined
Oct 17, 2012
Messages
11,422
Reputation
1,790
Daps
41,421
Reppin
NULL
So right now I’m taking an A+ course with udemy and also want to dab in some programming since I’m on temporary layoff with my company until July 2nd. I’m thinking of starting with python does any one have any suggestions on some good bootcamps or good source material to get started?
 

Macallik86

Superstar
Supporter
Joined
Dec 4, 2016
Messages
6,506
Reputation
1,372
Daps
21,227
So right now I’m taking an A+ course with udemy and also want to dab in some programming since I’m on temporary layoff with my company until July 2nd. I’m thinking of starting with python does any one have any suggestions on some good bootcamps or good source material to get started?
Here are some free resources that are highly rated.

Here are 3 free, lifetime resources I've come across that are geared towards people wanting to learn Python:

RealPython is giving away 4 Python Courses

Enjoy Free Courses, On Us – Real Python



There is a free eBook version of a popular Python Udemy Course. (The eBook is rated 4.5 stars on Amazon and would cost $24). Here is a summary from Amazon.com

Automate the Boring Stuff with Python



The publisher Manning is giving away two Python books the are highly rated on Amazon.
Book #1:

Get Programming - Learn to Code With Python (4.5 stars on Amazon and currently costs $31)


Book #2:

The Quick Python Book: 3rd Edition (4.5 stars on Amazon and currently costs $46)

If you are looking to pay a few bucks for a bootcamp-esque course on Udemy, then I have heard great things about these three:
 

Deflatedhoopdreams

Veteran
Supporter
Joined
May 29, 2012
Messages
35,791
Reputation
6,915
Daps
75,856
Reppin
The Rucker
Wrote my first Java Program yesterday.

It’s a employee pay roll program that takes the employees name and gross pay and calculates deductions, overtime worked and net pay after deductions. :ehh:

I like the detail you have to put in your Java code. It feels like I get to explain things better for some reason.
 

Obreh Winfrey

Truly Brehthtaking
Supporter
Joined
Nov 18, 2016
Messages
20,852
Reputation
25,252
Daps
131,941
I'm cooking up some stuff with maven to package the deployment configurations, allow people to generate them when they onboard, and override values to fit their overall configuration and environment. This should solve all of the duplication problems we're facing right now. I might need to pull some code into my repository, but it shouldn't be a lot.

I like the detail you have to put in your Java code. It feels like I get to explain things better for some reason
I like the verbosity of Java. If people follow good practices, things are fun to read through.
 
Top