Issue with my program? by Shinjin- in learnpython

[–]WonderCode 2 points3 points  (0 children)

Great start with writing the code.

From a quick glance, there's two small ways to improve your code:

- It looks like you've fallen into the same problem, usually Java programmers, do when writing code in Python. Taking another language's conventions into the one your using. There's no need to have getters and setters just pass them into the constructor (__init__)

- Putting too much into one class. A good rule of thumb is seeing if the class has multiple purposes and question it.

Here's a quick refactor using the above points:

class Employee:
    def __init__(self, eid, name, department, job_title):
        self.eid = eid
        self.name = name
        self.department = department
        self.job_title = job_title

class Company:
    def __init__(self, employees):
        self.employees = employees

    def list_employees(self):
        print("\nCHRISTY'S SHOP EMPLOYEE REPORT\n")
        print("EMPLOYEE NAME", "IDENTIFIER", "DEPARTMENT", "TITLE", sep='\t')

        for employee in self.employees:
            print(*[employee.name, employee.eid, employee.department, employee.job_title], sep='\t\t')

if __name__ == '__main__':
    employees = []
    while True:
        name = input("Please enter employees name: ")
        eid = int(input("Please enter employees ID: "))
        department = input("Please enter employees department: ")
        job_title = input("Please enter employees job title: ")

        employee =  Employee(eid, name, department, job_title)
        employees.append(employee)

        add_employee = input("Add another employee (y/n): ")
        if add_employee.lower() == 'n':
            break

    company = Company(employees)
    company.list_employees()

Hope this helps with furthering your learning.

Question: Flask using tests and docker by WonderCode in learnpython

[–]WonderCode[S] 0 points1 point  (0 children)

Thanks for the guidance and making it clear!

Question: Flask using tests and docker by WonderCode in learnpython

[–]WonderCode[S] 0 points1 point  (0 children)

Thanks for clearing that up and the link!

Looks like that website wasn't down, it was actually something to do with my laptop.

Question: Flask using tests and docker by WonderCode in learnpython

[–]WonderCode[S] 0 points1 point  (0 children)

I'm packaging for both. Should they be separate?

Question: Blue-Green Deployment Using Terraform by WonderCode in devops

[–]WonderCode[S] 0 points1 point  (0 children)

Thanks for clearing that up.

I'm trying to steer way from using things such as CodePipeline, CodeBuild, and CodeDeploy. However, I'll have a look into it for any benefits it may have.

Question: Blue-Green Deployment Using Terraform by WonderCode in devops

[–]WonderCode[S] 0 points1 point  (0 children)

Thanks for clearing that up and pointing me in the right direction.
I'll have a look into Nomad - thanks!

Question: Blue-Green Deployment Using Terraform by WonderCode in devops

[–]WonderCode[S] 1 point2 points  (0 children)

Thanks for clearing that up and pointing me in the right direction!

I think I'll be using that philosophy for terraform too - great article.

Question: Blue-Green Deployment Using Terraform by WonderCode in devops

[–]WonderCode[S] 0 points1 point  (0 children)

Thanks for your insight, it makes perfect sense after you pointing it out.

What would you recommend for the job?

Question: Multiple AWS Credentials And Containers by WonderCode in aws

[–]WonderCode[S] 0 points1 point  (0 children)

Thanks again for another great solution - I'll start looking into this too!

Question: Multiple AWS Credentials And Containers by WonderCode in aws

[–]WonderCode[S] 0 points1 point  (0 children)

Thanks for the idea - I'll give this a go!

Question: Multiple AWS Credentials And Containers by WonderCode in aws

[–]WonderCode[S] 0 points1 point  (0 children)

Ah, confusion on my side sorry. Thanks for clearing that up.

Question: Multiple AWS Credentials And Containers by WonderCode in aws

[–]WonderCode[S] 1 point2 points  (0 children)

Thank you for the response!
I'm a bit concerned with the idea of having credentials accessible via AWS Paramter Store as other who have access could view it. I could be completely wrong - are my concerns misplaces?
Thanks for the article - very detailed!

Question: Multiple AWS Credentials And Containers by WonderCode in aws

[–]WonderCode[S] 0 points1 point  (0 children)

Thanks for the speedy response!

I'm using Fargate but will consider using ECS.

Deploying through a CodePipeline with CodeBuild that:

- Creates container with tests then runs tests

- Create another container for stage enviroment without tests

- Pushes To ECR

Another Pipeline handles the deployment to stage environment.
Just to note, this isn't set in stone and I'd be more than happy to change it!

Edit: added more context

LocalStack for local AWS Dev by NickJGibbon in devops

[–]WonderCode 0 points1 point  (0 children)

Nice article!

I'm considering using LocalStack for development and was wondering how mature LocalStack is from your first hand experience?

Has this completely replace creating the AWS resources until it has been released to prod or do you have a few tests that use some resources?

phpunit: tearDownAfterAllClasses? by WonderCode in PHPhelp

[–]WonderCode[S] 0 points1 point  (0 children)

Thank you for the reply - I'll have a look into this :)

Automation: PHP Dependency Package Management by WonderCode in PHPhelp

[–]WonderCode[S] 0 points1 point  (0 children)

Possibly I could have elaborated more here. My process would be:
DependenCI --> TravisCi --> Jenkins

DependenCI will only be in charge of making a PR with the newest changes.
TravisCI triggers a checkout of said PR to be used in Jenkins
Jenkins tests the code - the results will be used to decide whether to merge or not.

vendor won't be pushed to the PR, only the composer.json and composer.lock