Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 948971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:19:45+00:00 2026-05-15T23:19:45+00:00

I’m coding a poker hand evaluator as my first programming project. I’ve made it

  • 0

I’m coding a poker hand evaluator as my first programming project. I’ve made it through three classes, each of which accomplishes its narrowly-defined task very well:

HandRange = a string-like object (e.g. “AA”). getHands() returns a list of tuples for each specific hand within the string:

[(Ad,Ac),(Ad,Ah),(Ad,As),(Ac,Ah),(Ac,As),(Ah,As)]

Translation = a dictionary that maps the return list from getHands to values that are useful for a given evaluator (yes, this can probably be refactored into another class).

{'As':52, 'Ad':51, ...}

Evaluator = takes a list from HandRange (as translated by Translator), enumerates all possible hand matchups and provides win % for each.

My question: what should my “domain” class for using all these classes look like, given that I may want to connect to it via either a shell UI or a GUI? Right now, it looks like an assembly line process:

user_input = HandRange()
x = Translation.translateList(user_input)
y = Evaluator.getEquities(x)

This smells funny in that it feels like it’s procedural when I ought to be using OO.

In a more general way: if I’ve spent so much time ensuring that my classes are well defined, narrowly focused, orthogonal, whatever … how do I actually manage work flow in my program when I need to use all of them in a row?

Thanks,

Mike

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:19:46+00:00Added an answer on May 15, 2026 at 11:19 pm

    Don’t make a fetish of object orientation — Python supports multiple paradigms, after all! Think of your user-defined types, AKA classes, as building blocks that gradually give you a “language” that’s closer to your domain rather than to general purpose language / library primitives.

    At some point you’ll want to code “verbs” (actions) that use your building blocks to perform something (under command from whatever interface you’ll supply — command line, RPC, web, GUI, …) — and those may be module-level functions as well as methods within some encompassing class. You’ll surely want a class if you need multiple instances, and most likely also if the actions involve updating “state” (instance variables of a class being much nicer than globals) or if inheritance and/or polomorphism come into play; but, there is no a priori reason to prefer classes to functions otherwise.

    If you find yourself writing static methods, yearning for a singleton (or Borg) design pattern, writing a class with no state (just methods) — these are all “code smells” that should prompt you to check whether you really need a class for that subset of your code, or rather whether you may be overcomplicating things and should use a module with functions for that part of your code. (Sometimes after due consideration you’ll unearth some different reason for preferring a class, and that’s allright too, but the point is, don’t just pick a class over a module w/functions “by reflex”, without critically thinking about it!).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 487k
  • Answers 487k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your setup should create the new source. This means that… May 16, 2026 at 8:20 am
  • Editorial Team
    Editorial Team added an answer $year = "2010"; // Year 2010 $week = "01"; //… May 16, 2026 at 8:20 am
  • Editorial Team
    Editorial Team added an answer This is normal. When you bind the validation to your… May 16, 2026 at 8:20 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Related Questions

No related questions found

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.